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 64600db commit 5d4804d
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->tpl->setContent($desc . $list->getHTML());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,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((string) $this->normalizeValue($record_value)) == strtolower((string) $this->normalizeValue(nl2br($value)))
if (strtolower((string) $this->normalizeValue($record_value)) == strtolower((string) $this->normalizeValue($value))
&& ($record->getId() != $record_id
|| $record_id == 0)
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,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 @@ -83,7 +83,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 @@ -175,4 +175,16 @@ public function step_11(): void
[ilDclDatatype::INPUTFORMAT_MOB]
);
}

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

0 comments on commit 5d4804d

Please sign in to comment.