commit
ac71d3f766
|
@ -344,6 +344,7 @@
|
||||||
"addon.mod_assign_submission_comments.pluginname": "assignsubmission_comments",
|
"addon.mod_assign_submission_comments.pluginname": "assignsubmission_comments",
|
||||||
"addon.mod_assign_submission_file.pluginname": "assignsubmission_file",
|
"addon.mod_assign_submission_file.pluginname": "assignsubmission_file",
|
||||||
"addon.mod_assign_submission_onlinetext.pluginname": "assignsubmission_onlinetext",
|
"addon.mod_assign_submission_onlinetext.pluginname": "assignsubmission_onlinetext",
|
||||||
|
"addon.mod_assign_submission_onlinetext.wordlimitexceeded": "assignsubmission_onlinetext",
|
||||||
"addon.mod_book.errorchapter": "book",
|
"addon.mod_book.errorchapter": "book",
|
||||||
"addon.mod_book.modulenameplural": "book",
|
"addon.mod_book.modulenameplural": "book",
|
||||||
"addon.mod_book.toc": "book",
|
"addon.mod_book.toc": "book",
|
||||||
|
|
|
@ -379,9 +379,13 @@ export class AddonModAssignProvider {
|
||||||
*
|
*
|
||||||
* @param {any} assign Assign.
|
* @param {any} assign Assign.
|
||||||
* @param {any} attempt Attempt.
|
* @param {any} attempt Attempt.
|
||||||
* @return {any} Submission object.
|
* @return {any} Submission object or null.
|
||||||
*/
|
*/
|
||||||
getSubmissionObjectFromAttempt(assign: any, attempt: any): any {
|
getSubmissionObjectFromAttempt(assign: any, attempt: any): any {
|
||||||
|
if (!attempt) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return assign.teamsubmission ? attempt.teamsubmission : attempt.submission;
|
return assign.teamsubmission ? attempt.teamsubmission : attempt.submission;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
{
|
{
|
||||||
"pluginname": "Online text submissions"
|
"pluginname": "Online text submissions",
|
||||||
|
"wordlimitexceeded": "The word limit for this assignment is {{$a.limit}} words and you are attempting to submit {{$a.count}} words. Please review your submission and try again."
|
||||||
}
|
}
|
|
@ -14,6 +14,7 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { Injectable, Injector } from '@angular/core';
|
import { Injectable, Injector } from '@angular/core';
|
||||||
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { CoreSitesProvider } from '@providers/sites';
|
import { CoreSitesProvider } from '@providers/sites';
|
||||||
import { CoreWSProvider } from '@providers/ws';
|
import { CoreWSProvider } from '@providers/ws';
|
||||||
import { CoreTextUtilsProvider } from '@providers/utils/text';
|
import { CoreTextUtilsProvider } from '@providers/utils/text';
|
||||||
|
@ -31,7 +32,7 @@ export class AddonModAssignSubmissionOnlineTextHandler implements AddonModAssign
|
||||||
name = 'AddonModAssignSubmissionOnlineTextHandler';
|
name = 'AddonModAssignSubmissionOnlineTextHandler';
|
||||||
type = 'onlinetext';
|
type = 'onlinetext';
|
||||||
|
|
||||||
constructor(private sitesProvider: CoreSitesProvider, private wsProvider: CoreWSProvider,
|
constructor(private translate: TranslateService, private sitesProvider: CoreSitesProvider, private wsProvider: CoreWSProvider,
|
||||||
private textUtils: CoreTextUtilsProvider, private assignProvider: AddonModAssignProvider,
|
private textUtils: CoreTextUtilsProvider, private assignProvider: AddonModAssignProvider,
|
||||||
private assignOfflineProvider: AddonModAssignOfflineProvider, private assignHelper: AddonModAssignHelperProvider) { }
|
private assignOfflineProvider: AddonModAssignOfflineProvider, private assignHelper: AddonModAssignHelperProvider) { }
|
||||||
|
|
||||||
|
@ -238,6 +239,19 @@ export class AddonModAssignSubmissionOnlineTextHandler implements AddonModAssign
|
||||||
|
|
||||||
let text = this.getTextToSubmit(plugin, inputData);
|
let text = this.getTextToSubmit(plugin, inputData);
|
||||||
|
|
||||||
|
// Check word limit.
|
||||||
|
const configs = this.assignHelper.getPluginConfig(assign, 'assignsubmission', plugin.type);
|
||||||
|
if (parseInt(configs.wordlimitenabled, 10)) {
|
||||||
|
const words = this.textUtils.countWords(text);
|
||||||
|
const wordlimit = parseInt(configs.wordlimit, 10);
|
||||||
|
if (words > wordlimit) {
|
||||||
|
const params = {$a: {count: words, limit: wordlimit}};
|
||||||
|
const message = this.translate.instant('addon.mod_assign_submission_onlinetext.wordlimitexceeded', params);
|
||||||
|
|
||||||
|
return Promise.reject(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add some HTML to the text if needed.
|
// Add some HTML to the text if needed.
|
||||||
text = this.textUtils.formatHtmlLines(text);
|
text = this.textUtils.formatHtmlLines(text);
|
||||||
|
|
||||||
|
|
|
@ -344,6 +344,7 @@
|
||||||
"addon.mod_assign_submission_comments.pluginname": "Submission comments",
|
"addon.mod_assign_submission_comments.pluginname": "Submission comments",
|
||||||
"addon.mod_assign_submission_file.pluginname": "File submissions",
|
"addon.mod_assign_submission_file.pluginname": "File submissions",
|
||||||
"addon.mod_assign_submission_onlinetext.pluginname": "Online text submissions",
|
"addon.mod_assign_submission_onlinetext.pluginname": "Online text submissions",
|
||||||
|
"addon.mod_assign_submission_onlinetext.wordlimitexceeded": "The word limit for this assignment is {{$a.limit}} words and you are attempting to submit {{$a.count}} words. Please review your submission and try again.",
|
||||||
"addon.mod_book.errorchapter": "Error reading chapter of book.",
|
"addon.mod_book.errorchapter": "Error reading chapter of book.",
|
||||||
"addon.mod_book.modulenameplural": "Books",
|
"addon.mod_book.modulenameplural": "Books",
|
||||||
"addon.mod_book.toc": "Table of contents",
|
"addon.mod_book.toc": "Table of contents",
|
||||||
|
|
Loading…
Reference in New Issue