Moodle

Resource summary is shown with preceding newline

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.6
  • Fix Version/s: 2.0
  • Component/s: Resource
  • Labels:
    None
  • Environment:
    All

Description

Look at Resources list:

http://moodle.org/mod/resource/index.php?id=34

You may see that many summaries are shifted one line down vertically. That is because summary is created with WYSIWYG HTML editor (which add one new line at the beginning), but then output is performed in FORMAT_MOODLE format.

The following fix works:

RCS file: /cvsroot/moodle/moodle/mod/resource/index.php,v

retrieving revision 1.16

diff -u -u -r1.16 index.php

— index.php 16 Jun 2005 10:10:59 -0000 1.16

+++ index.php 5 Nov 2005 19:04:56 -0000

@@ -73,12 +73,12 @@

if (!$resource->visible) { // Show dimmed if the mod is hidden $table->data[] = array ($printsection, <a class=\dimmed\ $extra href=\view.php?id=$resource->coursemodule\>.format_string($resource->name,true).</a>, - format_text($resource->summary, FORMAT_MOODLE, $options) ); + format_text($resource->summary, FORMAT_HTML, $options) ); } else { //Show normal if the mod is visible $table->data[] = array ($printsection, <a $extra href=\view.php?id=$resource->coursemodule\>.format_string($resource->name,true).</a>, - format_text($resource->summary, FORMAT_MOODLE, $options) ); + format_text($resource->summary, FORMAT_HTML, $options) ); }

}

Best regards,

Grigory Rubtsov.

Activity

Hide
Martin Dougiamas added a comment -

From Christian Lebe (christian at moodle.com) Tuesday, 8 November 2005, 11:09 AM:

fixed.

Thanks Grigory.

From Christian Lebe (christian at moodle.com) Tuesday, 8 November 2005, 12:07 PM:

Rolled back, due complexity of solution to be done.

Grigory, try to use unformatted HTML style if you want to add new resources.

From Grigory Rubtsov (grb at sentence.ru) Tuesday, 8 November 2005, 03:18 PM:

In unformatted HTML, I also have summary edited with WYSIWYG editor. Do I understand correctly, that different formatting option is for main text only?

From Martin Dougiamas (martin at moodle.com) Tuesday, 8 November 2005, 03:51 PM:

The problem is that Moodle text may be in many formats. If you turn off your editor you'll see options such as Markdown, plain text etc. It isn't just HTML.

We don't currently store the format of the resource summaries (or assignment summaries etc). We need to fix this by adding a new field to the resource table, assignment table etc.

Should be fixed in 1.6 once and for all.

From Eloy Lafuente (stronk7 at moodle.org) Saturday, 29 April 2006, 10:33 PM:

Just recalling you about the need to add the textformat field to a bunch of tables in order to keep the format well detected....before 1.6! :-/

It could be done quickly (if I'm not wrong)...backup/restore included, of course.

Show
Martin Dougiamas added a comment - From Christian Lebe (christian at moodle.com) Tuesday, 8 November 2005, 11:09 AM: fixed. Thanks Grigory. From Christian Lebe (christian at moodle.com) Tuesday, 8 November 2005, 12:07 PM: Rolled back, due complexity of solution to be done. Grigory, try to use unformatted HTML style if you want to add new resources. From Grigory Rubtsov (grb at sentence.ru) Tuesday, 8 November 2005, 03:18 PM: In unformatted HTML, I also have summary edited with WYSIWYG editor. Do I understand correctly, that different formatting option is for main text only? From Martin Dougiamas (martin at moodle.com) Tuesday, 8 November 2005, 03:51 PM: The problem is that Moodle text may be in many formats. If you turn off your editor you'll see options such as Markdown, plain text etc. It isn't just HTML. We don't currently store the format of the resource summaries (or assignment summaries etc). We need to fix this by adding a new field to the resource table, assignment table etc. Should be fixed in 1.6 once and for all. From Eloy Lafuente (stronk7 at moodle.org) Saturday, 29 April 2006, 10:33 PM: Just recalling you about the need to add the textformat field to a bunch of tables in order to keep the format well detected....before 1.6! :-/ It could be done quickly (if I'm not wrong)...backup/restore included, of course.
Hide
Katja Krüger added a comment -

I have the same problem still, in Version 1.8.2+ with forum and assignment. When I update an assignment and I go into html-mode in the WYSiWIG editor and I use tags, there is this newline added which turns into a break after I submitted the update and look onto it again.
It would be nice if somebody could delete this newline in WYSIWIG editor. My solution now was to remove the newline afterwards. I added in lib/weblib.php line 1882 : $text = trim($text);

Show
Katja Krüger added a comment - I have the same problem still, in Version 1.8.2+ with forum and assignment. When I update an assignment and I go into html-mode in the WYSiWIG editor and I use tags, there is this newline added which turns into a break after I submitted the update and look onto it again. It would be nice if somebody could delete this newline in WYSIWIG editor. My solution now was to remove the newline afterwards. I added in lib/weblib.php line 1882 : $text = trim($text);
Hide
Petr Škoda (skodak) added a comment -

This should be finally fixed in 2.0dev, most text fields now have proper format associated with it.
Thanks for the report.

Show
Petr Škoda (skodak) added a comment - This should be finally fixed in 2.0dev, most text fields now have proper format associated with it. Thanks for the report.

People

Vote (3)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: