commit
6547bcf541
|
@ -322,19 +322,12 @@ export class AddonModAssignProvider {
|
|||
}
|
||||
|
||||
filearea.files.forEach((file) => {
|
||||
let filename;
|
||||
|
||||
if (file.filename) {
|
||||
filename = file.filename;
|
||||
} else {
|
||||
if (!file.filename) {
|
||||
// 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({
|
||||
filename: filename,
|
||||
fileurl: file.fileurl
|
||||
});
|
||||
files.push(file);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
<!-- Read only. -->
|
||||
<ion-item text-wrap *ngIf="files && files.length && !edit">
|
||||
<h2>{{plugin.name}}</h2>
|
||||
<div *ngFor="let file of files" no-lines>
|
||||
<!-- Files already attached to the submission. -->
|
||||
<core-file *ngIf="!file.name" [file]="file" [component]="component" [componentId]="assign.cmid" [alwaysDownload]="true"></core-file>
|
||||
<div no-lines>
|
||||
<ng-container *ngFor="let file of files">
|
||||
<!-- 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. -->
|
||||
<core-local-file *ngIf="file.name" [file]="file"></core-local-file>
|
||||
<!-- Files stored in offline to be sent later. -->
|
||||
<core-local-file *ngIf="file.name" [file]="file"></core-local-file>
|
||||
</ng-container>
|
||||
</div>
|
||||
</ion-item>
|
||||
|
||||
|
|
|
@ -9,11 +9,13 @@
|
|||
</span>
|
||||
|
||||
<ng-container *ngIf="isShowOrListMode()">
|
||||
<div *ngFor="let file of files" no-lines>
|
||||
<!-- Files already attached to the submission. -->
|
||||
<core-file *ngIf="!file.name" [file]="file" [component]="component" [componentId]="componentId" [alwaysDownload]="true"></core-file>
|
||||
<div no-lines>
|
||||
<ng-container *ngFor="let file of files">
|
||||
<!-- 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. -->
|
||||
<core-local-file *ngIf="file.name" [file]="file"></core-local-file>
|
||||
<!-- Files stored in offline to be sent later. -->
|
||||
<core-local-file *ngIf="file.name" [file]="file"></core-local-file>
|
||||
</ng-container>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
|
|
@ -16,11 +16,13 @@
|
|||
</ion-card-header>
|
||||
<ion-card-content padding-top>
|
||||
<core-format-text [component]="component" [componentId]="componentId" [text]="post.message"></core-format-text>
|
||||
<div *ngFor="let attachment of post.attachments">
|
||||
<!-- Files already attached to the submission. -->
|
||||
<core-file *ngIf="!attachment.name" [file]="attachment" [component]="component" [componentId]="componentId"></core-file>
|
||||
<!-- Files stored in offline to be sent later. -->
|
||||
<core-local-file *ngIf="attachment.name" [file]="attachment"></core-local-file>
|
||||
<div no-lines>
|
||||
<ng-container *ngFor="let attachment of post.attachments">
|
||||
<!-- Files already attached to the submission. -->
|
||||
<core-file *ngIf="!attachment.name" [file]="attachment" [component]="component" [componentId]="componentId"></core-file>
|
||||
<!-- Files stored in offline to be sent later. -->
|
||||
<core-local-file *ngIf="attachment.name" [file]="attachment"></core-local-file>
|
||||
</ng-container>
|
||||
</div>
|
||||
</ion-card-content>
|
||||
<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>
|
||||
</ion-item>
|
||||
<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>
|
||||
<ion-item text-wrap *ngIf="entry.approved != 1">
|
||||
<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>
|
||||
</ion-item>
|
||||
<ion-item *ngIf="!edit && workshop.overallfeedbackfiles && data.assessment.feedbackattachmentfiles && data.assessment.feedbackattachmentfiles.length">
|
||||
<ng-container *ngFor="let attachment of data.assessment.feedbackattachmentfiles">
|
||||
<!-- Files already attached to the submission. -->
|
||||
<core-file *ngIf="!attachment.name" [file]="attachment" [component]="component" [componentId]="componentId"></core-file>
|
||||
<!-- Files stored in offline to be sent later. -->
|
||||
<core-local-file *ngIf="attachment.name" [file]="attachment"></core-local-file>
|
||||
</ng-container>
|
||||
<div no-lines>
|
||||
<ng-container *ngFor="let attachment of data.assessment.feedbackattachmentfiles">
|
||||
<!-- Files already attached to the submission. -->
|
||||
<core-file *ngIf="!attachment.name" [file]="attachment" [component]="component" [componentId]="componentId"></core-file>
|
||||
<!-- Files stored in offline to be sent later. -->
|
||||
<core-local-file *ngIf="attachment.name" [file]="attachment"></core-local-file>
|
||||
</ng-container>
|
||||
</div>
|
||||
</ion-item>
|
||||
</ion-card>
|
||||
</core-loading>
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
</ion-item>
|
||||
|
||||
<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>
|
||||
</section>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<a ion-item text-wrap class="item-media" (click)="download($event, true)" detail-none>
|
||||
<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>
|
||||
<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>
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
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;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ import { CoreSitesProvider } from '@providers/sites';
|
|||
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
||||
import { CoreMimetypeUtilsProvider } from '@providers/utils/mimetype';
|
||||
import { CoreUtilsProvider } from '@providers/utils/utils';
|
||||
import { CoreTextUtilsProvider } from '@providers/utils/text';
|
||||
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.
|
||||
// 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() 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.
|
||||
|
||||
isDownloaded: boolean;
|
||||
|
@ -46,6 +49,7 @@ export class CoreFileComponent implements OnInit, OnDestroy {
|
|||
showDownload: boolean;
|
||||
fileIcon: string;
|
||||
fileName: string;
|
||||
fileSizeReadable: string;
|
||||
|
||||
protected fileUrl: string;
|
||||
protected siteId: string;
|
||||
|
@ -57,7 +61,7 @@ export class CoreFileComponent implements OnInit, OnDestroy {
|
|||
constructor(private sitesProvider: CoreSitesProvider, private utils: CoreUtilsProvider, private domUtils: CoreDomUtilsProvider,
|
||||
private filepoolProvider: CoreFilepoolProvider, private appProvider: CoreAppProvider,
|
||||
private fileHelper: CoreFileHelperProvider, private mimeUtils: CoreMimetypeUtilsProvider,
|
||||
private eventsProvider: CoreEventsProvider) {
|
||||
private eventsProvider: CoreEventsProvider, private textUtils: CoreTextUtilsProvider) {
|
||||
this.onDelete = new EventEmitter();
|
||||
}
|
||||
|
||||
|
@ -75,6 +79,12 @@ export class CoreFileComponent implements OnInit, OnDestroy {
|
|||
this.fileSize = this.file.filesize;
|
||||
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) {
|
||||
this.alwaysDownload = true; // Always show the download button in external files.
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue