本文整理汇总了TypeScript中@core/fileuploader/providers/fileuploader.CoreFileUploaderProvider类的典型用法代码示例。如果您正苦于以下问题:TypeScript CoreFileUploaderProvider类的具体用法?TypeScript CoreFileUploaderProvider怎么用?TypeScript CoreFileUploaderProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CoreFileUploaderProvider类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: uploadOrStoreSubmissionFiles
/**
* Upload or store some files for a submission, depending if the user is offline or not.
*
* @param {number} workshopId Workshop ID.
* @param {number} submissionId If not editing, it will refer to timecreated.
* @param {any[]} files List of files.
* @param {boolean} editing If the submission is being edited or added otherwise.
* @param {boolean} offline True if files sould be stored for offline, false to upload them.
* @param {string} [siteId] Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved if success.
*/
uploadOrStoreSubmissionFiles(workshopId: number, submissionId: number, files: any[], editing: boolean, offline: boolean,
siteId?: string): Promise<any> {
if (offline) {
return this.storeSubmissionFiles(workshopId, submissionId, editing, files, siteId);
} else {
return this.uploaderProvider.uploadOrReuploadFiles(files, AddonModWorkshopProvider.COMPONENT, workshopId, siteId);
}
}
示例2: uploadOrStoreNewDiscussionFiles
/**
* Upload or store some files for a new discussion, depending if the user is offline or not.
*
* @param {number} forumId Forum ID.
* @param {number} timecreated The time the discussion was created.
* @param {any[]} files List of files.
* @param {boolean} offline True if files sould be stored for offline, false to upload them.
* @param {string} [siteId] Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved if success.
*/
uploadOrStoreNewDiscussionFiles(forumId: number, timecreated: number, files: any[], offline: boolean, siteId?: string)
: Promise<any> {
if (offline) {
return this.storeNewDiscussionFiles(forumId, timecreated, files, siteId);
} else {
return this.uploaderProvider.uploadOrReuploadFiles(files, AddonModForumProvider.COMPONENT, forumId, siteId);
}
}
示例3: uploadOrStoreAssessmentFiles
/**
* Upload or store some files for an assessment, depending if the user is offline or not.
*
* @param {number} workshopId Workshop ID.
* @param {number} assessmentId ID.
* @param {any[]} files List of files.
* @param {boolean} offline True if files sould be stored for offline, false to upload them.
* @param {string} [siteId] Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved if success.
*/
uploadOrStoreAssessmentFiles(workshopId: number, assessmentId: number, files: any[], offline: boolean, siteId?: string):
Promise<any> {
if (offline) {
return this.storeAssessmentFiles(workshopId, assessmentId, files, siteId);
} else {
return this.uploaderProvider.uploadOrReuploadFiles(files, AddonModWorkshopProvider.COMPONENT, workshopId, siteId);
}
}
示例4: uploadOrStoreReplyFiles
/**
* Upload or store some files for a reply, depending if the user is offline or not.
*
* @param {number} forumId Forum ID.
* @param {number} postId ID of the post being replied.
* @param {any[]} files List of files.
* @param {boolean} offline True if files sould be stored for offline, false to upload them.
* @param {string} [siteId] Site ID. If not defined, current site.
* @param {number} [userId] User the reply belongs to. If not defined, current user in site.
* @return {Promise<any>} Promise resolved if success.
*/
uploadOrStoreReplyFiles(forumId: number, postId: number, files: any[], offline: boolean, siteId?: string, userId?: number)
: Promise<any> {
if (offline) {
return this.storeReplyFiles(forumId, postId, files, siteId, userId);
} else {
return this.uploaderProvider.uploadOrReuploadFiles(files, AddonModForumProvider.COMPONENT, forumId, siteId);
}
}
示例5: uploadOrStoreFiles
/**
* Upload or store some files, depending if the user is offline or not.
*
* @param {number} glossaryId Glossary ID.
* @param {string} entryName The name of the entry.
* @param {number} [timeCreated] The time the entry was created.
* @param {any[]} files List of files.
* @param {boolean} offline True if files sould be stored for offline, false to upload them.
* @param {string} [siteId] Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved if success.
*/
uploadOrStoreFiles(glossaryId: number, entryName: string, timeCreated: number, files: any[], offline: boolean,
siteId?: string): Promise<any> {
if (offline) {
return this.storeFiles(glossaryId, entryName, timeCreated, files, siteId);
} else {
return this.uploaderProvider.uploadOrReuploadFiles(files, AddonModGlossaryProvider.COMPONENT, glossaryId, siteId);
}
}
示例6: uploadOrStoreFiles
/**
* Upload or store some files, depending if the user is offline or not.
*
* @param {number} dataId Database ID.
* @param {number} [itemId=0] Draft ID to use. Undefined or 0 to create a new draft ID.
* @param {number} entryId Entry ID or, if creating, timemodified.
* @param {number} fieldId Field ID.
* @param {any[]} files List of files.
* @param {boolean} offline True if files sould be stored for offline, false to upload them.
* @param {string} [siteId] Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved if success.
*/
uploadOrStoreFiles(dataId: number, itemId: number = 0, entryId: number, fieldId: number, files: any[], offline: boolean,
siteId?: string): Promise<any> {
if (files.length) {
if (offline) {
return this.storeFiles(dataId, entryId, fieldId, files, siteId);
}
return this.fileUploaderProvider.uploadOrReuploadFiles(files, AddonModDataProvider.COMPONENT, itemId, siteId);
}
return Promise.resolve(0);
}
示例7: hasPostDataChanged
/**
* Check if the data of a post/discussion has changed.
*
* @param {any} post Current data.
* @param {any} [original] Original ata.
* @return {boolean} True if data has changed, false otherwise.
*/
hasPostDataChanged(post: any, original?: any): boolean {
if (!original || original.subject == null) {
// There is no original data, assume it hasn't changed.
return false;
}
if (post.subject != original.subject || post.message != original.message) {
return true;
}
return this.uploaderProvider.areFileListDifferent(post.files, original.files);
}
示例8: hasEntryDataChanged
/**
* Check if the data of an entry has changed.
*
* @param {any} entry Current data.
* @param {any[]} files Files attached.
* @param {any} original Original content.
* @return {boolean} True if data has changed, false otherwise.
*/
hasEntryDataChanged(entry: any, files: any[], original: any): boolean {
if (!original || typeof original.concept == 'undefined') {
// There is no original data.
return entry.definition || entry.concept || files.length > 0;
}
if (original.definition != entry.definition || original.concept != entry.concept) {
return true;
}
return this.uploaderProvider.areFileListDifferent(files, original.files);
}
示例9: ngOnInit
/**
* Component being initialized.
*/
ngOnInit(): void {
this.maxSize = Number(this.maxSize); // Make sure it's defined and it's a number.
this.maxSize = !isNaN(this.maxSize) && this.maxSize > 0 ? this.maxSize : -1;
if (this.maxSize == -1) {
this.maxSizeReadable = this.translate.instant('core.unknown');
} else {
this.maxSizeReadable = this.textUtils.bytesToSize(this.maxSize, 2);
}
if (typeof this.maxSubmissions == 'undefined' || this.maxSubmissions < 0) {
this.maxSubmissionsReadable = this.translate.instant('core.unknown');
this.unlimitedFiles = true;
} else {
this.maxSubmissionsReadable = String(this.maxSubmissions);
}
if (this.acceptedTypes && this.acceptedTypes.trim()) {
this.fileTypes = this.fileUploaderProvider.prepareFiletypeList(this.acceptedTypes);
}
}
示例10:
return this.forumOffline.getNewDiscussionFolder(forumId, timecreated, siteId).then((folderPath) => {
return this.uploaderProvider.getStoredFiles(folderPath);
});