Merge pull request #2608 from dpalou/MOBILE-2272
MOBILE-2272 essay: Fix issues with attachments in essaymain
commit
1664b3a793
|
@ -1577,8 +1577,7 @@ export class AddonModQuizProvider {
|
|||
const question = result.questions[i];
|
||||
|
||||
if (!question.settings) {
|
||||
// Site doesn't return settings, stop.
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
question.settings = this.textUtils.parseJSON(question.settings, null);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<!-- Draft files not supported. -->
|
||||
<ng-container *ngIf="question.textarea && question.hasDraftFiles && !uploadFilesSupported">
|
||||
<ion-item text-wrap class="core-danger-item">
|
||||
<p class="core-question-warning">{{ 'core.question.errorinlinefilesnotsupportedinsite' | translate }}</p>
|
||||
<p class="core-question-warning">{{ 'core.question.errorembeddedfilesnotsupportedinsite' | translate }}</p>
|
||||
</ion-item>
|
||||
<ion-item text-wrap>
|
||||
<p><core-format-text [component]="component" [componentId]="componentId" [text]="question.textarea.text" [contextLevel]="contextLevel" [contextInstanceId]="contextInstanceId" [courseId]="courseId"></core-format-text></p>
|
||||
|
|
|
@ -130,7 +130,7 @@ export class AddonQtypeEssayHandler implements CoreQuestionHandler {
|
|||
}
|
||||
|
||||
if (!uploadFilesSupported && this.questionHelper.hasDraftFileUrls(element.innerHTML)) {
|
||||
return 'core.question.errorinlinefilesnotsupportedinsite';
|
||||
return 'core.question.errorembeddedfilesnotsupportedinsite';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,8 @@ export class CoreAttachmentsComponent implements OnInit {
|
|||
const siteInfo = currentSite && currentSite.getInfo();
|
||||
|
||||
if (siteInfo && siteInfo.usermaxuploadfilesize) {
|
||||
this.maxSizeReadable = this.textUtils.bytesToSize(siteInfo.usermaxuploadfilesize, 2);
|
||||
this.maxSize = siteInfo.usermaxuploadfilesize;
|
||||
this.maxSizeReadable = this.textUtils.bytesToSize(this.maxSize, 2);
|
||||
} else {
|
||||
this.maxSizeReadable = this.translate.instant('core.unknown');
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import { CoreTextUtilsProvider } from '@providers/utils/text';
|
|||
import { CoreUtilsProvider, PromiseDefer } from '@providers/utils/utils';
|
||||
import { CoreFileUploaderProvider, CoreFileUploaderOptions } from './fileuploader';
|
||||
import { CoreFileUploaderDelegate } from './delegate';
|
||||
import { CoreSites } from '@providers/sites';
|
||||
|
||||
/**
|
||||
* Helper service to upload files.
|
||||
|
@ -697,6 +698,15 @@ export class CoreFileUploaderHelperProvider {
|
|||
* @return Promise resolved when done.
|
||||
*/
|
||||
async uploadFileObject(file: any, maxSize?: number, upload?: boolean, allowOffline?: boolean, name?: string): Promise<any> {
|
||||
if (maxSize === 0) {
|
||||
const currentSite = CoreSites.instance.getCurrentSite();
|
||||
const siteInfo = currentSite && currentSite.getInfo();
|
||||
|
||||
if (siteInfo && siteInfo.usermaxuploadfilesize) {
|
||||
maxSize = siteInfo.usermaxuploadfilesize;
|
||||
}
|
||||
}
|
||||
|
||||
if (maxSize != -1 && file.size > maxSize) {
|
||||
return this.errorMaxBytes(maxSize, file.name);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue