MDL-87560 assignsubmission_onlinetext: indicate truncated summary.
Only when the submission has been truncated should we show the "View more" link, otherwise it appears to not do anything for already short text.
This commit is contained in:
@@ -361,16 +361,13 @@ class assign_submission_onlinetext extends assign_submission_plugin {
|
||||
* Display onlinetext word count in the submission status table
|
||||
*
|
||||
* @param stdClass $submission
|
||||
* @param bool $showviewlink - If the summary has been truncated set this to true
|
||||
* @param bool $showviewlink - If the summary has been truncated, this should be set to true
|
||||
* @return string
|
||||
*/
|
||||
public function view_summary(stdClass $submission, & $showviewlink) {
|
||||
global $CFG;
|
||||
|
||||
$onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
|
||||
// Always show the view link.
|
||||
$showviewlink = true;
|
||||
|
||||
if ($onlinetextsubmission) {
|
||||
// This contains the shortened version of the text plus an optional 'Export to portfolio' button.
|
||||
$text = $this->assignment->render_editor_content(ASSIGNSUBMISSION_ONLINETEXT_FILEAREA,
|
||||
@@ -395,8 +392,10 @@ class assign_submission_onlinetext extends assign_submission_plugin {
|
||||
'course' => $this->assignment->get_course()->id,
|
||||
'assignment' => $submission->assignment));
|
||||
}
|
||||
// We compare the actual text submission and the shortened version. If they are not equal, we show the word count.
|
||||
if ($onlinetext != $shorttext) {
|
||||
|
||||
// Compare the actual text submission and the shortened version. If not equal, we show the word count/view more link.
|
||||
$showviewlink = $onlinetext != $shorttext;
|
||||
if ($showviewlink) {
|
||||
$wordcount = get_string('numwords', 'assignsubmission_onlinetext', count_words($onlinetext));
|
||||
|
||||
return $plagiarismlinks . $wordcount . $text;
|
||||
|
||||
@@ -37,14 +37,16 @@ Feature: In an assignment, students can add and edit text online
|
||||
| Online text | I'm the student first submission |
|
||||
And I press "Save changes"
|
||||
Then I should see "Submitted for grading"
|
||||
And I should see "I'm the student first submission"
|
||||
And "View full" "icon" should not exist in the "Online text" "table_row"
|
||||
And I should see "I'm the student first submission" in the "Online text" "table_row"
|
||||
And I should see "Not graded"
|
||||
And I press "Edit submission"
|
||||
And I set the following fields to these values:
|
||||
| Online text | I'm the student second submission |
|
||||
And I press "Save changes"
|
||||
Then I should see "Submitted for grading"
|
||||
And I should see "I'm the student second submission"
|
||||
And "View full" "icon" should not exist in the "Online text" "table_row"
|
||||
And I should see "I'm the student second submission" in the "Online text" "table_row"
|
||||
And I should not see "I'm the student first submission"
|
||||
|
||||
@javascript
|
||||
|
||||
Reference in New Issue
Block a user