summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2013-12-27 17:30:18 +0000
committerGreg Roach <fisharebest@gmail.com>2013-12-27 17:30:18 +0000
commitcdb8eb03db713cac6568bd8f24a52d46ba610f6d (patch)
tree05942fe56060fbde28f077977383b15dd56b5615 /includes
parent870818b50f3599d032dc59c71da0508a276a1194 (diff)
downloadwebtrees-cdb8eb03db713cac6568bd8f24a52d46ba610f6d.tar.gz
webtrees-cdb8eb03db713cac6568bd8f24a52d46ba610f6d.tar.bz2
webtrees-cdb8eb03db713cac6568bd8f24a52d46ba610f6d.zip
Re-enable the 'expand notes by default' option
Diffstat (limited to 'includes')
-rw-r--r--includes/functions/functions_print.php22
1 files changed, 19 insertions, 3 deletions
diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php
index 36f7858b42..840787c653 100644
--- a/includes/functions/functions_print.php
+++ b/includes/functions/functions_print.php
@@ -417,10 +417,26 @@ function print_note_record($text, $nlevel, $nrec, $textOnly=false) {
if (strpos($text, "\n") === false) {
// A one-line note? strip the block-level tags, so it displays inline
- $html = strip_tags($html, '<a><strong><em>');
+ return WT_Gedcom_Tag::getLabelValue($label, strip_tags($html, '<a><strong><em>'));
+ } elseif ($WT_TREE->preference('EXPAND_NOTES')) {
+ // A multi-line note, and we're expanding notes by default
+ return WT_Gedcom_Tag::getLabelValue($label, $html);
+ } else {
+ // A multi-line note, with an expand/collapse option
+ $element_id = 'n-' . uniqid();
+ list($first, $rest) = explode("\n", $html, 2);
+ // If the first line contains HTML, we cannot easily display it after the "Note:" label.
+ // It may contain the first line of a table, an HREF that spans newlines, etc.
+ if (strpos($first, '<') !== false) {
+ $first = '';
+ $rest = $html;
+ }
+ return
+ '<div class="fact_NOTE"><span class="label">' .
+ '<a href="#" onclick="expand_layer(\'' . $element_id . '\'); return false;"><i id="' . $element_id . '_img" class="icon-plus"></i></a> ' . WT_Gedcom_Tag::getLabel($label) . ': ' .
+ '</div>' .
+ '<div id="' . $element_id . '" style="display:none">' . $html . '</div>';
}
-
- return WT_Gedcom_Tag::getLabelValue($label, $html);
}
/**