commit
6547bcf541
|
@ -322,19 +322,12 @@ export class AddonModAssignProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
filearea.files.forEach((file) => {
|
filearea.files.forEach((file) => {
|
||||||
let filename;
|
if (!file.filename) {
|
||||||
|
|
||||||
if (file.filename) {
|
|
||||||
filename = file.filename;
|
|
||||||
} else {
|
|
||||||
// We don't have filename, extract it from the path.
|
// We don't have filename, extract it from the path.
|
||||||
filename = file.filepath[0] == '/' ? file.filepath.substr(1) : file.filepath;
|
file.filename = file.filepath[0] == '/' ? file.filepath.substr(1) : file.filepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
files.push({
|
files.push(file);
|
||||||
filename: filename,
|
|
||||||
fileurl: file.fileurl
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
<!-- Read only. -->
|
<!-- Read only. -->
|
||||||
<ion-item text-wrap *ngIf="files && files.length && !edit">
|
<ion-item text-wrap *ngIf="files && files.length && !edit">
|
||||||
<h2>{{plugin.name}}</h2>
|
<h2>{{plugin.name}}</h2>
|
||||||
<div *ngFor="let file of files" no-lines>
|
<div no-lines>
|
||||||
<!-- Files already attached to the submission. -->
|
<ng-container *ngFor="let file of files">
|
||||||
<core-file *ngIf="!file.name" [file]="file" [component]="component" [componentId]="assign.cmid" [alwaysDownload]="true"></core-file>
|
<!-- Files already attached to the submission. -->
|
||||||
|
<core-file *ngIf="!file.name" [file]="file" [component]="component" [componentId]="assign.cmid" [alwaysDownload]="true"></core-file>
|
||||||
|
|
||||||
<!-- Files stored in offline to be sent later. -->
|
<!-- Files stored in offline to be sent later. -->
|
||||||
<core-local-file *ngIf="file.name" [file]="file"></core-local-file>
|
<core-local-file *ngIf="file.name" [file]="file"></core-local-file>
|
||||||
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,13 @@
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<ng-container *ngIf="isShowOrListMode()">
|
<ng-container *ngIf="isShowOrListMode()">
|
||||||
<div *ngFor="let file of files" no-lines>
|
<div no-lines>
|
||||||
<!-- Files already attached to the submission. -->
|
<ng-container *ngFor="let file of files">
|
||||||
<core-file *ngIf="!file.name" [file]="file" [component]="component" [componentId]="componentId" [alwaysDownload]="true"></core-file>
|
<!-- Files already attached to the submission. -->
|
||||||
|
<core-file *ngIf="!file.name" [file]="file" [component]="component" [componentId]="componentId" [alwaysDownload]="true"></core-file>
|
||||||
|
|
||||||
<!-- Files stored in offline to be sent later. -->
|
<!-- Files stored in offline to be sent later. -->
|
||||||
<core-local-file *ngIf="file.name" [file]="file"></core-local-file>
|
<core-local-file *ngIf="file.name" [file]="file"></core-local-file>
|
||||||
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
|
@ -16,11 +16,13 @@
|
||||||
</ion-card-header>
|
</ion-card-header>
|
||||||
<ion-card-content padding-top>
|
<ion-card-content padding-top>
|
||||||
<core-format-text [component]="component" [componentId]="componentId" [text]="post.message"></core-format-text>
|
<core-format-text [component]="component" [componentId]="componentId" [text]="post.message"></core-format-text>
|
||||||
<div *ngFor="let attachment of post.attachments">
|
<div no-lines>
|
||||||
<!-- Files already attached to the submission. -->
|
<ng-container *ngFor="let attachment of post.attachments">
|
||||||
<core-file *ngIf="!attachment.name" [file]="attachment" [component]="component" [componentId]="componentId"></core-file>
|
<!-- Files already attached to the submission. -->
|
||||||
<!-- Files stored in offline to be sent later. -->
|
<core-file *ngIf="!attachment.name" [file]="attachment" [component]="component" [componentId]="componentId"></core-file>
|
||||||
<core-local-file *ngIf="attachment.name" [file]="attachment"></core-local-file>
|
<!-- Files stored in offline to be sent later. -->
|
||||||
|
<core-local-file *ngIf="attachment.name" [file]="attachment"></core-local-file>
|
||||||
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</ion-card-content>
|
</ion-card-content>
|
||||||
<ion-item no-padding text-end *ngIf="post.id && post.canreply" class="addon-forum-reply-button">
|
<ion-item no-padding text-end *ngIf="post.id && post.canreply" class="addon-forum-reply-button">
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
<core-format-text [component]="component" [componentId]="componentId" [text]="entry.definition"></core-format-text>
|
<core-format-text [component]="component" [componentId]="componentId" [text]="entry.definition"></core-format-text>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ng-container *ngIf="entry.attachment">
|
<ng-container *ngIf="entry.attachment">
|
||||||
<core-file *ngFor="let file of entry.attachments" [file]="file" [component]="component" [componentId]="componentId"></core-file>
|
<div no-lines>
|
||||||
|
<core-file *ngFor="let file of entry.attachments" [file]="file" [component]="component" [componentId]="componentId"></core-file>
|
||||||
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ion-item text-wrap *ngIf="entry.approved != 1">
|
<ion-item text-wrap *ngIf="entry.approved != 1">
|
||||||
<p><em>{{ 'addon.mod_glossary.entrypendingapproval' | translate }}</em></p>
|
<p><em>{{ 'addon.mod_glossary.entrypendingapproval' | translate }}</em></p>
|
||||||
|
|
|
@ -31,12 +31,14 @@
|
||||||
<core-format-text [component]="component" [componentId]="componentId" [text]="data.assessment.feedbackauthor"></core-format-text>
|
<core-format-text [component]="component" [componentId]="componentId" [text]="data.assessment.feedbackauthor"></core-format-text>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item *ngIf="!edit && workshop.overallfeedbackfiles && data.assessment.feedbackattachmentfiles && data.assessment.feedbackattachmentfiles.length">
|
<ion-item *ngIf="!edit && workshop.overallfeedbackfiles && data.assessment.feedbackattachmentfiles && data.assessment.feedbackattachmentfiles.length">
|
||||||
<ng-container *ngFor="let attachment of data.assessment.feedbackattachmentfiles">
|
<div no-lines>
|
||||||
<!-- Files already attached to the submission. -->
|
<ng-container *ngFor="let attachment of data.assessment.feedbackattachmentfiles">
|
||||||
<core-file *ngIf="!attachment.name" [file]="attachment" [component]="component" [componentId]="componentId"></core-file>
|
<!-- Files already attached to the submission. -->
|
||||||
<!-- Files stored in offline to be sent later. -->
|
<core-file *ngIf="!attachment.name" [file]="attachment" [component]="component" [componentId]="componentId"></core-file>
|
||||||
<core-local-file *ngIf="attachment.name" [file]="attachment"></core-local-file>
|
<!-- Files stored in offline to be sent later. -->
|
||||||
</ng-container>
|
<core-local-file *ngIf="attachment.name" [file]="attachment"></core-local-file>
|
||||||
|
</ng-container>
|
||||||
|
</div>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</ion-card>
|
</ion-card>
|
||||||
</core-loading>
|
</core-loading>
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<ion-item *ngIf="!question.textarea && question.attachments && question.attachments.length">
|
<ion-item *ngIf="!question.textarea && question.attachments && question.attachments.length">
|
||||||
<core-file *ngFor="let attachment of question.attachments" [file]="attachment" [component]="component" [componentId]="componentId"></core-file>
|
<div no-lines>
|
||||||
|
<core-file *ngFor="let attachment of question.attachments" [file]="attachment" [component]="component" [componentId]="componentId"></core-file>
|
||||||
|
</div>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<a ion-item text-wrap class="item-media" (click)="download($event, true)" detail-none>
|
<a ion-item text-wrap class="item-media" (click)="download($event, true)" detail-none>
|
||||||
<img [src]="fileIcon" alt="" role="presentation" item-start />
|
<img [src]="fileIcon" alt="" role="presentation" item-start />
|
||||||
<p>{{fileName}}</p>
|
<h2>{{fileName}}</h2>
|
||||||
|
<p *ngIf="fileSizeReadable">{{ fileSizeReadable }}</p>
|
||||||
|
<p *ngIf="showTime">{{ timemodified * 1000 | coreFormatDate:"dfmediumdate" }}</p>
|
||||||
<div class="buttons" item-end>
|
<div class="buttons" item-end>
|
||||||
<button ion-button clear icon-only (click)="download($event)" *ngIf="!isDownloading && showDownload" [attr.aria-label]="'core.download' | translate" color="dark">
|
<button ion-button clear icon-only (click)="download($event)" *ngIf="!isDownloading && showDownload" [attr.aria-label]="'core.download' | translate" color="dark">
|
||||||
<ion-icon [name]="isDownloaded ? 'refresh' : 'cloud-download'"></ion-icon>
|
<ion-icon [name]="isDownloaded ? 'refresh' : 'cloud-download'"></ion-icon>
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
ion-app.app-root {
|
ion-app.app-root {
|
||||||
.card-md core-file + core-file > .item-md.item-block > .item-inner {
|
.card-md core-file + core-file > .item-md.item-block > .item-inner,
|
||||||
|
core-file + core-file > .item-md.item-block > .item-inner {
|
||||||
border-top: 1px solid $list-md-border-color;
|
border-top: 1px solid $list-md-border-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-ios core-file + core-file > .item-ios.item-block > .item-inner {
|
.card-ios core-file + core-file > .item-ios.item-block > .item-inner,
|
||||||
|
core-file + core-file > .item-ios.item-block > .item-inner {
|
||||||
border-top: $hairlines-width solid $list-ios-border-color;
|
border-top: $hairlines-width solid $list-ios-border-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-wp core-file + core-file > .item-wp.item-block > .item-inner {
|
.card-wp core-file + core-file > .item-wp.item-block > .item-inner,
|
||||||
|
core-file + core-file > .item-wp.item-block > .item-inner {
|
||||||
border-top: 1px solid $list-wp-border-color;
|
border-top: 1px solid $list-wp-border-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,6 +21,7 @@ import { CoreSitesProvider } from '@providers/sites';
|
||||||
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
||||||
import { CoreMimetypeUtilsProvider } from '@providers/utils/mimetype';
|
import { CoreMimetypeUtilsProvider } from '@providers/utils/mimetype';
|
||||||
import { CoreUtilsProvider } from '@providers/utils/utils';
|
import { CoreUtilsProvider } from '@providers/utils/utils';
|
||||||
|
import { CoreTextUtilsProvider } from '@providers/utils/text';
|
||||||
import { CoreConstants } from '@core/constants';
|
import { CoreConstants } from '@core/constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,6 +40,8 @@ export class CoreFileComponent implements OnInit, OnDestroy {
|
||||||
@Input() alwaysDownload?: boolean | string; // Whether it should always display the refresh button when the file is downloaded.
|
@Input() alwaysDownload?: boolean | string; // Whether it should always display the refresh button when the file is downloaded.
|
||||||
// Use it for files that you cannot determine if they're outdated or not.
|
// Use it for files that you cannot determine if they're outdated or not.
|
||||||
@Input() canDownload?: boolean | string = true; // Whether file can be downloaded.
|
@Input() canDownload?: boolean | string = true; // Whether file can be downloaded.
|
||||||
|
@Input() showSize?: boolean | string = true; // Whether show filesize.
|
||||||
|
@Input() showTime?: boolean | string = true; // Whether show file time modified.
|
||||||
@Output() onDelete?: EventEmitter<void>; // Will notify when the delete button is clicked.
|
@Output() onDelete?: EventEmitter<void>; // Will notify when the delete button is clicked.
|
||||||
|
|
||||||
isDownloaded: boolean;
|
isDownloaded: boolean;
|
||||||
|
@ -46,6 +49,7 @@ export class CoreFileComponent implements OnInit, OnDestroy {
|
||||||
showDownload: boolean;
|
showDownload: boolean;
|
||||||
fileIcon: string;
|
fileIcon: string;
|
||||||
fileName: string;
|
fileName: string;
|
||||||
|
fileSizeReadable: string;
|
||||||
|
|
||||||
protected fileUrl: string;
|
protected fileUrl: string;
|
||||||
protected siteId: string;
|
protected siteId: string;
|
||||||
|
@ -57,7 +61,7 @@ export class CoreFileComponent implements OnInit, OnDestroy {
|
||||||
constructor(private sitesProvider: CoreSitesProvider, private utils: CoreUtilsProvider, private domUtils: CoreDomUtilsProvider,
|
constructor(private sitesProvider: CoreSitesProvider, private utils: CoreUtilsProvider, private domUtils: CoreDomUtilsProvider,
|
||||||
private filepoolProvider: CoreFilepoolProvider, private appProvider: CoreAppProvider,
|
private filepoolProvider: CoreFilepoolProvider, private appProvider: CoreAppProvider,
|
||||||
private fileHelper: CoreFileHelperProvider, private mimeUtils: CoreMimetypeUtilsProvider,
|
private fileHelper: CoreFileHelperProvider, private mimeUtils: CoreMimetypeUtilsProvider,
|
||||||
private eventsProvider: CoreEventsProvider) {
|
private eventsProvider: CoreEventsProvider, private textUtils: CoreTextUtilsProvider) {
|
||||||
this.onDelete = new EventEmitter();
|
this.onDelete = new EventEmitter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +79,12 @@ export class CoreFileComponent implements OnInit, OnDestroy {
|
||||||
this.fileSize = this.file.filesize;
|
this.fileSize = this.file.filesize;
|
||||||
this.fileName = this.file.filename;
|
this.fileName = this.file.filename;
|
||||||
|
|
||||||
|
if (this.utils.isTrueOrOne(this.showSize) && this.fileSize >= 0) {
|
||||||
|
this.fileSizeReadable = this.textUtils.bytesToSize(this.fileSize, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.showTime = this.utils.isTrueOrOne(this.showTime) && this.timemodified > 0;
|
||||||
|
|
||||||
if (this.file.isexternalfile) {
|
if (this.file.isexternalfile) {
|
||||||
this.alwaysDownload = true; // Always show the download button in external files.
|
this.alwaysDownload = true; // Always show the download button in external files.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue