-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3938 from crazyserver/MOBILE-4329
Mobile 4329
- Loading branch information
Showing
50 changed files
with
1,669 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/core/features/dataprivacy/components/components.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// (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. | ||
|
||
import { NgModule } from '@angular/core'; | ||
import { CoreSharedModule } from '@/core/shared.module'; | ||
import { CoreDataPrivacyContactDPOComponent } from './contactdpo/contactdpo'; | ||
import { CoreDataPrivacyNewRequestComponent } from './newrequest/newrequest'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
CoreDataPrivacyContactDPOComponent, | ||
CoreDataPrivacyNewRequestComponent, | ||
], | ||
imports: [ | ||
CoreSharedModule, | ||
], | ||
exports: [ | ||
CoreDataPrivacyContactDPOComponent, | ||
CoreDataPrivacyNewRequestComponent, | ||
], | ||
}) | ||
export class CoreDataPrivacyComponentsModule {} |
37 changes: 37 additions & 0 deletions
37
src/core/features/dataprivacy/components/contactdpo/contactdpo.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title> | ||
<h1>{{ 'core.dataprivacy.contactdataprotectionofficer' | translate }}</h1> | ||
</ion-title> | ||
<ion-buttons slot="end"> | ||
<ion-button fill="clear" (click)="close()" [attr.aria-label]="'core.close' | translate"> | ||
<ion-icon slot="icon-only" name="fas-xmark" aria-hidden="true" /> | ||
</ion-button> | ||
</ion-buttons> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content> | ||
<form [formGroup]="form" name="contactDPO" (ngSubmit)="send($event)"> | ||
<ion-item *ngIf="email"> | ||
<ion-label> | ||
<p class="item-heading"> | ||
{{ 'core.dataprivacy.replyto' | translate }} | ||
</p> | ||
<p>{{ email }}</p> | ||
</ion-label> | ||
</ion-item> | ||
<ion-item> | ||
<ion-textarea labelPlacement="floating" placeholder="{{ 'core.dataprivacy.message' | translate }}" rows="5" | ||
[(ngModel)]="message" name="text" [required]="true" formControlName="message"> | ||
<div [core-mark-required]="true" slot="label"> | ||
{{ 'core.dataprivacy.message' | translate }} | ||
</div> | ||
</ion-textarea> | ||
</ion-item> | ||
</form> | ||
</ion-content> | ||
<ion-footer slot="fixed" class="ion-padding"> | ||
<ion-button expand="block" (click)="send($event)" [disabled]="!form.valid"> | ||
{{ 'core.dataprivacy.send' | translate }} | ||
</ion-button> | ||
</ion-footer> |
94 changes: 94 additions & 0 deletions
94
src/core/features/dataprivacy/components/contactdpo/contactdpo.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// (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. | ||
|
||
import { Component, OnInit } from '@angular/core'; | ||
import { FormGroup, FormBuilder, Validators } from '@angular/forms'; | ||
import { CoreDataPrivacy } from '@features/dataprivacy/services/dataprivacy'; | ||
import { CoreUser } from '@features/user/services/user'; | ||
import { CoreSites } from '@services/sites'; | ||
import { CoreDomUtils, ToastDuration } from '@services/utils/dom'; | ||
import { CoreUtils } from '@services/utils/utils'; | ||
|
||
import { ModalController } from '@singletons'; | ||
|
||
/** | ||
* Component that displays the contact DPO page. | ||
*/ | ||
@Component({ | ||
selector: 'core-data-privacy-contact-dpo', | ||
templateUrl: 'contactdpo.html', | ||
}) | ||
export class CoreDataPrivacyContactDPOComponent implements OnInit { | ||
|
||
message = ''; | ||
email = ''; | ||
|
||
// Form variables. | ||
form: FormGroup; | ||
|
||
constructor( | ||
protected fb: FormBuilder, | ||
) { | ||
this.form = new FormGroup({}); | ||
|
||
// Initialize form variables. | ||
this.form.addControl('message', this.fb.control('', Validators.required)); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
async ngOnInit(): Promise<void> { | ||
const modal = await CoreDomUtils.showModalLoading(); | ||
|
||
// Get current user email. | ||
const userId = CoreSites.getCurrentSiteUserId(); | ||
const user = await CoreUtils.ignoreErrors(CoreUser.getProfile(userId)); | ||
|
||
this.email = user?.email || ''; | ||
|
||
modal.dismiss(); | ||
} | ||
|
||
/** | ||
* Sends the message. | ||
*/ | ||
async send(event: Event): Promise<void> { | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
|
||
const modal = await CoreDomUtils.showModalLoading(); | ||
|
||
try { | ||
// Send the message. | ||
const succeed = await CoreDataPrivacy.contactDPO(this.message); | ||
if (succeed) { | ||
CoreDomUtils.showToast('core.dataprivacy.requestsubmitted', true, ToastDuration.LONG); | ||
ModalController.dismiss(true); | ||
} | ||
} catch (error) { | ||
CoreDomUtils.showErrorModalDefault(error, 'Error sending data privacy request'); | ||
} finally { | ||
modal.dismiss(); | ||
} | ||
} | ||
|
||
/** | ||
* Close modal. | ||
*/ | ||
close(): void { | ||
ModalController.dismiss(); | ||
} | ||
|
||
} |
Oops, something went wrong.