Merge pull request #3745 from crazyserver/MOBILE-4379

Mobile 4379
main
Noel De Martin 2023-07-20 09:47:58 +09:00 committed by GitHub
commit 8c97b6fe32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 22 deletions

View File

@ -496,7 +496,7 @@
"addon.mod_chat.nosessionsfound": "local_moodlemobileapp", "addon.mod_chat.nosessionsfound": "local_moodlemobileapp",
"addon.mod_chat.saidto": "chat", "addon.mod_chat.saidto": "chat",
"addon.mod_chat.send": "chat", "addon.mod_chat.send": "chat",
"addon.mod_chat.sessionstart": "chat", "addon.mod_chat.sessionstartsin": "chat",
"addon.mod_chat.showincompletesessions": "local_moodlemobileapp", "addon.mod_chat.showincompletesessions": "local_moodlemobileapp",
"addon.mod_chat.talk": "chat", "addon.mod_chat.talk": "chat",
"addon.mod_chat.viewreport": "chat", "addon.mod_chat.viewreport": "chat",

View File

@ -22,7 +22,7 @@ function copy_lang {
lang=$1 lang=$1
index_keys=$(jq -r 'to_entries[] | "\"\(.key)\","' langindex.json) index_keys=$(jq -r 'to_entries[] | "\"\(.key)\","' langindex.json)
index_keys=${index_keys:0:-1} index_keys=${index_keys:0:${#index_keys}-1}
hyphenlang=${lang/_/-} hyphenlang=${lang/_/-}
langfilepath=$LANG_PATH/$hyphenlang.json langfilepath=$LANG_PATH/$hyphenlang.json

View File

@ -200,13 +200,21 @@
{{ 'addon.mod_assign.editsubmission' | translate }} {{ 'addon.mod_assign.editsubmission' | translate }}
</ion-button> </ion-button>
</ng-container> </ng-container>
<ion-item class="core-danger-item ion-text-wrap" *ngIf="(unsupportedEditPlugins <ion-item class="core-danger-item ion-text-wrap"
&& unsupportedEditPlugins.length && !showErrorStatementEdit)|| showErrorStatementEdit"> *ngIf="(unsupportedEditPlugins.length && !showErrorStatementEdit)|| showErrorStatementEdit">
<ion-label> <ion-label>
<ng-container <ng-container
*ngIf="unsupportedEditPlugins && unsupportedEditPlugins.length && !showErrorStatementEdit"> *ngIf="unsupportedEditPlugins && unsupportedEditPlugins.length && !showErrorStatementEdit">
<p>{{ 'addon.mod_assign.erroreditpluginsnotsupported' | translate }}</p> <p>{{ 'addon.mod_assign.erroreditpluginsnotsupported' | translate }}</p>
<p *ngFor="let name of unsupportedEditPlugins">{{ name }}</p> <ul>
<li *ngFor="let name of unsupportedEditPlugins">{{ name }}</li>
</ul>
<ion-button expand="block" *ngIf="submissionUrl" [href]="submissionUrl" core-link
[showBrowserWarning]="false">
{{ 'core.openinbrowser' | translate }}
<ion-icon name="fas-up-right-from-square" slot="end" aria-hidden="true"></ion-icon>
</ion-button>
</ng-container> </ng-container>
<ng-container *ngIf="showErrorStatementEdit"> <ng-container *ngIf="showErrorStatementEdit">
<p>{{ 'addon.mod_assign.cannoteditduetostatementsubmission' | translate }}</p> <p>{{ 'addon.mod_assign.cannoteditduetostatementsubmission' | translate }}</p>

View File

@ -127,6 +127,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
canSaveGrades = false; // Whether the user can save the grades. canSaveGrades = false; // Whether the user can save the grades.
allowAddAttempt = false; // Allow adding a new attempt when grading. allowAddAttempt = false; // Allow adding a new attempt when grading.
gradeUrl?: string; // URL to grade in browser. gradeUrl?: string; // URL to grade in browser.
submissionUrl?: string; // URL to add/edit a submission in browser.
isPreviousAttemptEmpty = true; // Whether the previous attempt contains an empty submission. isPreviousAttemptEmpty = true; // Whether the previous attempt contains an empty submission.
showDates = false; // Whether to show some dates. showDates = false; // Whether to show some dates.
timeLimitFinished = false; // Whether there is a time limit and it finished, so the user will submit late. timeLimitFinished = false; // Whether there is a time limit and it finished, so the user will submit late.
@ -793,6 +794,12 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
*/ */
protected async loadUnsupportedPlugins(): Promise<void> { protected async loadUnsupportedPlugins(): Promise<void> {
this.unsupportedEditPlugins = await AddonModAssign.getUnsupportedEditPlugins(this.userSubmission?.plugins || []); this.unsupportedEditPlugins = await AddonModAssign.getUnsupportedEditPlugins(this.userSubmission?.plugins || []);
if (this.unsupportedEditPlugins && !this.submissionUrl) {
const mod = await CoreCourse.getModule(this.moduleId, this.courseId, undefined, true);
this.submissionUrl = `${mod.url}&action=editsubmission`;
}
} }
/** /**

View File

@ -13,10 +13,10 @@
[courseId]="courseId" (completionChanged)="onCompletionChange()"> [courseId]="courseId" (completionChanged)="onCompletionChange()">
</core-course-module-info> </core-course-module-info>
<ion-card *ngIf="chatInfo" class="core-info-card"> <ion-card *ngIf="chatTime" class="core-info-card">
<ion-item> <ion-item>
<ion-icon name="fas-clock" slot="start" aria-hidden="true"></ion-icon> <ion-icon name="fas-clock" slot="start" aria-hidden="true"></ion-icon>
<ion-label>{{ 'addon.mod_chat.sessionstart' | translate:{$a: chatInfo} }}</ion-label> <ion-label>{{ 'addon.mod_chat.sessionstartsin' | translate:{$a: chatTime} }}</ion-label>
</ion-item> </ion-item>
</ion-card> </ion-card>

View File

@ -34,10 +34,7 @@ export class AddonModChatIndexComponent extends CoreCourseModuleMainActivityComp
component = AddonModChatProvider.COMPONENT; component = AddonModChatProvider.COMPONENT;
pluginName = 'chat'; pluginName = 'chat';
chat?: AddonModChatChat; chat?: AddonModChatChat;
chatInfo?: { chatTime?: string;
date: string;
fromnow: string;
};
constructor( constructor(
protected content?: IonContent, protected content?: IonContent,
@ -62,17 +59,11 @@ export class AddonModChatIndexComponent extends CoreCourseModuleMainActivityComp
this.chat = await AddonModChat.getChat(this.courseId, this.module.id); this.chat = await AddonModChat.getChat(this.courseId, this.module.id);
this.description = this.chat.intro; this.description = this.chat.intro;
const now = CoreTimeUtils.timestamp(); const chatTimeSeconds = (this.chat.chattime || 0) - CoreTimeUtils.timestamp();
const span = (this.chat.chattime || 0) - now;
if (this.chat.chattime && this.chat.schedule && span > 0) { this.chatTime = this.chat.schedule && chatTimeSeconds > 0
this.chatInfo = { ? CoreTime.formatTime(chatTimeSeconds)
date: CoreTimeUtils.userDate(this.chat.chattime * 1000), : undefined;
fromnow: CoreTime.formatTime(span),
};
} else {
this.chatInfo = undefined;
}
this.dataRetrieved.emit(this.chat); this.dataRetrieved.emit(this.chat);
} }

View File

@ -22,7 +22,7 @@
"nosessionsfound": "No sessions found", "nosessionsfound": "No sessions found",
"saidto": "said to", "saidto": "said to",
"send": "Send", "send": "Send",
"sessionstart": "The next chat session will start on {{$a.date}}, ({{$a.fromnow}} from now)", "sessionstartsin": "The next chat session will start {{$a}} from now.",
"showincompletesessions": "Show incomplete sessions", "showincompletesessions": "Show incomplete sessions",
"talk": "Talk", "talk": "Talk",
"viewreport": "Past sessions" "viewreport": "Past sessions"