Skip to content

Commit

Permalink
Remove br from save and add to presentation
Browse files Browse the repository at this point in the history
  • Loading branch information
iszmais committed Jul 2, 2024
1 parent 0b007d2 commit e2f3be9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function listRecords(bool $use_tableview_filter = false): void
if ($ilSetting->get('advanced_editing_javascript_editor')) {
$desc = "<div class='ilDclTableDescription'>" . $desc . "</div>";
} else {
$desc = "<div class='ilDclTableDescription'>" . nl2br(ilUtil::stripSlashes($desc)) . "</div>";
$desc = "<div class='ilDclTableDescription'>" . nl2br(htmlspecialchars($desc, ENT_QUOTES | ENT_SUBSTITUTE, 'utf-8')) . "</div>";
}
}
$this->dclUi->setContent($desc . $list->getHTML());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function checkValidity($value, ?int $record_id = null): bool
//for text it has to be case insensitive.
$record_value = $record->getRecordFieldValue($this->getId());

if (strtolower($this->normalizeValue($record_value)) == strtolower($this->normalizeValue(nl2br($value)))
if (strtolower($this->normalizeValue($record_value)) == strtolower($this->normalizeValue($value))
&& ($record->getId() != $record_id
|| $record_id == 0)
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function parseValue($value)
if ($this->getField()->getProperty(ilDclBaseFieldModel::PROP_TEXTAREA)
&& !$this->getField()->getProperty(ilDclBaseFieldModel::PROP_URL)
) {
return nl2br($value);
return $value;
}

return $value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function getHTML(bool $link = true, array $options = []): string
'renderRecord'
) . '">' . $value . '</a>';
} else {
$html = (is_array($value) && isset($value['link'])) ? $value['link'] : $value;
$html = (is_array($value) && isset($value['link'])) ? $value['link'] : nl2br($value);
}

if (!$html) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,16 @@ public function step_8(): void
[ilDclDatatype::INPUTFORMAT_MOB]
);
}

public function step_9(): void
{
$this->db->manipulateF(
'UPDATE il_dcl_stloc1_value value '.
'INNER JOIN il_dcl_record_field rf ON rf.id = value.record_field_id ' .
'INNER JOIN il_dcl_field field ON field.id = rf.field_id ' .
'SET value.name = REPLACE(value.name, "<br />", "\r\n") WHERE field.datatype_id = %s',
[ilDBConstants::T_INTEGER],
[ilDclDatatype::INPUTFORMAT_TEXT]
);
}
}

0 comments on commit e2f3be9

Please sign in to comment.