summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2014-05-01 13:05:56 +0100
committerGreg Roach <fisharebest@gmail.com>2014-05-01 13:05:56 +0100
commite705689d7e463783c53b4e37ac867ab6dae4f418 (patch)
tree8c2595edec041dac061bf39233c0e377639a68ec
parent2fb7e5d3e3555aad450a13373f8b944be1b2bada (diff)
downloadwebtrees-e705689d7e463783c53b4e37ac867ab6dae4f418.tar.gz
webtrees-e705689d7e463783c53b4e37ac867ab6dae4f418.tar.bz2
webtrees-e705689d7e463783c53b4e37ac867ab6dae4f418.zip
#1280903
-rw-r--r--includes/functions/functions_print.php3
-rw-r--r--includes/functions/functions_print_facts.php26
2 files changed, 17 insertions, 12 deletions
diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php
index d5d5ce60fd..c380a512d2 100644
--- a/includes/functions/functions_print.php
+++ b/includes/functions/functions_print.php
@@ -445,7 +445,6 @@ function print_fact_notes($factrec, $level, $textOnly=false) {
$nlevel = $level+1;
$ct = preg_match_all("/$level NOTE (.*)/", $factrec, $match, PREG_SET_ORDER);
for ($j=0; $j<$ct; $j++) {
- $nid = str_replace("@","",$match[$j][1]);
$spos1 = strpos($factrec, $match[$j][0], $previous_spos);
$spos2 = strpos($factrec."\n$level", "\n$level", $spos1+1);
if (!$spos2) $spos2 = strlen($factrec);
@@ -469,7 +468,7 @@ function print_fact_notes($factrec, $level, $textOnly=false) {
}
}
} else {
- $data='<div class="fact_NOTE"><span class="label">'.WT_I18N::translate('Note').'</span>: <span class="field error">'.$nid.'</span></div>';
+ $data='<div class="fact_NOTE"><span class="label">'.WT_I18N::translate('Note').'</span>: <span class="field error">'.$nmatch[1].'</span></div>';
}
}
if (!$textOnly) {
diff --git a/includes/functions/functions_print_facts.php b/includes/functions/functions_print_facts.php
index 37d40ab60c..d7dad56f6a 100644
--- a/includes/functions/functions_print_facts.php
+++ b/includes/functions/functions_print_facts.php
@@ -867,6 +867,18 @@ function print_main_notes(WT_Fact $fact, $level) {
$ct = preg_match_all("/$level NOTE(.*)/", $factrec, $match, PREG_SET_ORDER);
for ($j=0; $j<$ct; $j++) {
+ // Note object, or inline note?
+ if (preg_match("/$level NOTE @(.*)@/", $match[$j][0], $nmatch)) {
+ $nid = $nmatch[1];
+ $note = WT_Note::getInstance($nid);
+ if ($note && !$note->canShow()) {
+ continue;
+ }
+ } else {
+ $nid = null;
+ $note = null;
+ }
+
if ($level>=2) echo '<tr class="row_note2">';
else echo '<tr>';
echo '<td class="descriptionbox';
@@ -920,19 +932,13 @@ function print_main_notes(WT_Fact $fact, $level) {
}
}
echo '</td>';
- if (preg_match("/$level NOTE @(.*)@/", $match[$j][0], $nmatch)) {
+ if ($note) {
// Note objects
- $nid = $nmatch[1];
- $note = WT_Note::getInstance($nid);
- if ($note) {
+ if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) {
// If Census assistant installed, allow it to format the note
- if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) {
- $text = GEDFact_assistant_WT_Module::formatCensusNote($note);
- } else {
- $text = WT_Filter::formatText($note->getNote(), $WT_TREE);
- }
+ $text = GEDFact_assistant_WT_Module::formatCensusNote($note);
} else {
- $text = '<span class="error">' . WT_Filter::escapeHtml($nid) . '</span>';
+ $text = WT_Filter::formatText($note->getNote(), $WT_TREE);
}
} else {
// Inline notes