summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Module/CensusAssistantModule.php63
-rw-r--r--app/Module/IndividualFactsTabModule.php15
-rw-r--r--app/Module/NotesTabModule.php11
-rw-r--r--modules_v3/GEDFact_assistant/census/census-edit.php39
-rw-r--r--themes/clouds/css-1.7.4/style.css22
-rw-r--r--themes/colors/css-1.7.4/style.css22
-rw-r--r--themes/fab/css-1.7.4/style.css22
-rw-r--r--themes/minimal/css-1.7.4/style.css22
-rw-r--r--themes/webtrees/css-1.7.4/style.css24
-rw-r--r--themes/xenea/css-1.7.4/style.css22
10 files changed, 170 insertions, 92 deletions
diff --git a/app/Module/CensusAssistantModule.php b/app/Module/CensusAssistantModule.php
index 812c794e8f..bf5f1addd6 100644
--- a/app/Module/CensusAssistantModule.php
+++ b/app/Module/CensusAssistantModule.php
@@ -28,6 +28,7 @@ use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Menu;
use Fisharebest\Webtrees\Note;
+use Fisharebest\Webtrees\Soundex;
/**
* Class CensusAssistantModule
@@ -279,18 +280,6 @@ class CensusAssistantModule extends AbstractModule {
public static function formatCensusNote(Note $note) {
global $WT_TREE;
-
- $headers = array();
- foreach (Census::allCensusPlaces() as $allCensusesOfPlace) {
- foreach ($allCensusesOfPlace->allCensusDates() as $census) {
- foreach ($census->columns() as $column) {
- if ($column->abbreviation()) {
- $headers[$column->abbreviation()] = $column->title();
- }
- }
- }
- }
-
if (preg_match('/(.*)((?:\n.*)*)\n\.start_formatted_area\.\n(.*)((?:\n.*)*)\n.end_formatted_area\.((?:\n.*)*)/', $note->getNote(), $match)) {
// This looks like a census-assistant shared note
$title = Filter::escapeHtml($match[1]);
@@ -299,18 +288,48 @@ class CensusAssistantModule extends AbstractModule {
$data = Filter::escapeHtml($match[4]);
$postamble = Filter::escapeHtml($match[5]);
- $fmt_headers = array();
- foreach ($headers as $key => $value) {
- $fmt_headers[$key] = '<span title="' . Filter::escapeHtml($value) . '">' . $key . '</span>';
- }
+ // Get the column headers for the census to which this note refers
+ // requires the fact place & date to match the specific census
+ // censusPlace() (Soundex match) and censusDate() functions
+ $fmt_headers = array();
+ $linkedRecords = array_merge($note->linkedIndividuals('NOTE'), $note->linkedFamilies('NOTE'));
+ $firstRecord = array_shift($linkedRecords);
+ if ($firstRecord) {
+ $countryCode = '';
+ $date = '';
+ foreach ($firstRecord->getFacts('CENS') as $fact) {
+ if (trim($fact->getAttribute('NOTE'), '@') === $note->getXref()) {
+ $date = $fact->getAttribute('DATE');
+ $place = explode(',', strip_tags($fact->getPlace()->getFullName()));
+ $countryCode = Soundex::daitchMokotoff(array_pop($place));
+ break;
+ }
+ }
- // Substitue header labels and format as HTML
+ foreach (Census::allCensusPlaces() as $censusPlace) {
+ if (Soundex::compare($countryCode, Soundex::daitchMokotoff($censusPlace->censusPlace()))) {
+ foreach ($censusPlace->allCensusDates() as $census) {
+ if ($census->censusDate() == $date) {
+ foreach ($census->columns() as $column) {
+ $abbrev = $column->abbreviation();
+ if ($abbrev) {
+ $description = $column->title() ? $column->title() : I18N::translate('Description unavailable');
+ $fmt_headers[$abbrev] = '<span title="' . $description . '">' . $abbrev . '</span>';
+ }
+ }
+ break 2;
+ }
+ }
+ }
+ }
+ }
+ // Substitute header labels and format as HTML
$thead = '<tr><th>' . strtr(str_replace('|', '</th><th>', $header), $fmt_headers) . '</th></tr>';
$thead = str_replace('.b.', '', $thead);
// Format data as HTML
$tbody = '';
- foreach (explode("\n", $data) as $row) {
+ foreach (explode("\n", ltrim($data)) as $row) {
$tbody .= '<tr>';
foreach (explode('|', $row) as $column) {
$tbody .= '<td>' . $column . '</td>';
@@ -320,12 +339,14 @@ class CensusAssistantModule extends AbstractModule {
return
$title . "\n" . // The newline allows the framework to expand the details and turn the first line into a link
+ '<div class="markdown census-assistant-note">' .
'<p>' . $preamble . '</p>' .
- '<table class="table-census-assistant">' .
+ '<table>' .
'<thead>' . $thead . '</thead>' .
'<tbody>' . $tbody . '</tbody>' .
'</table>' .
- '<p>' . $postamble . '</p>';
+ '<p>' . $postamble . '</p>' .
+ '</div>';
} else {
// Not a census-assistant shared note - apply default formatting
return Filter::formatText($note->getNote(), $WT_TREE);
@@ -348,7 +369,7 @@ class CensusAssistantModule extends AbstractModule {
$html .= '<th title="' . $column->title() . '">' . $column->abbreviation() . '</th>';
}
- return '<tr><th hidden></th>' . $html . '<th></th></th></tr>';
+ return '<tr><th hidden></th>' . $html . '<th></th></tr>';
}
/**
diff --git a/app/Module/IndividualFactsTabModule.php b/app/Module/IndividualFactsTabModule.php
index 1065686373..8d36b0891d 100644
--- a/app/Module/IndividualFactsTabModule.php
+++ b/app/Module/IndividualFactsTabModule.php
@@ -120,13 +120,7 @@ class IndividualFactsTabModule extends AbstractModule implements ModuleTabInterf
ob_start();
- echo '<table class="facts_table">';
- echo '<tbody>';
- if (!$indifacts) {
- echo '<tr><td colspan="2" class="facts_value">', I18N::translate('There are no facts for this individual.'), '</td></tr>';
- }
-
- echo '<tr><td colspan="2" class="descriptionbox rela"><form action="?"><input id="checkbox_rela_facts" type="checkbox" ';
+ echo '<div class="descriptionbox rela"><form action="?"><input id="checkbox_rela_facts" type="checkbox" ';
echo $controller->record->getTree()->getPreference('EXPAND_RELATIVES_EVENTS') ? 'checked' : '';
echo ' onclick="jQuery(\'tr.rela\').toggle();"><label for="checkbox_rela_facts">', I18N::translate('Events of close relatives'), '</label>';
if (file_exists(Site::getPreference('INDEX_DIRECTORY') . 'histo.' . WT_LOCALE . '.php')) {
@@ -134,7 +128,12 @@ class IndividualFactsTabModule extends AbstractModule implements ModuleTabInterf
echo $EXPAND_HISTO_EVENTS ? 'checked' : '';
echo ' onclick="jQuery(\'tr.histo\').toggle();"><label for="checkbox_histo">', I18N::translate('Historical facts'), '</label>';
}
- echo '</form></td></tr>';
+ echo '</form></div>';
+ echo '<table class="facts_table">';
+ echo '<tbody>';
+ if (!$indifacts) {
+ echo '<tr><td colspan="2" class="facts_value">', I18N::translate('There are no facts for this individual.'), '</td></tr>';
+ }
foreach ($indifacts as $fact) {
FunctionsPrintFacts::printFact($fact, $controller->record);
diff --git a/app/Module/NotesTabModule.php b/app/Module/NotesTabModule.php
index 1bab581a22..5b4e31037f 100644
--- a/app/Module/NotesTabModule.php
+++ b/app/Module/NotesTabModule.php
@@ -61,14 +61,13 @@ class NotesTabModule extends AbstractModule implements ModuleTabInterface {
global $WT_TREE, $controller;
ob_start();
- echo '<table class="facts_table">';
?>
- <tr>
- <td colspan="2" class="descriptionbox rela">
+ <div class="descriptionbox rela">
<input id="checkbox_note2" type="checkbox" <?php echo $WT_TREE->getPreference('SHOW_LEVEL2_NOTES') ? 'checked' : ''; ?> onclick="jQuery('tr.row_note2').toggle();">
- <label for="checkbox_note2"><?php echo I18N::translate('Show all notes'); ?></label>
- </td>
- </tr>
+ <label for="checkbox_note2"><?php echo I18N::translate('Show all notes'); ?></label>
+ </div>
+ <table class="facts_table">
+
<?php
foreach ($this->getFactsWithNotes() as $fact) {
if ($fact->getTag() == 'NOTE') {
diff --git a/modules_v3/GEDFact_assistant/census/census-edit.php b/modules_v3/GEDFact_assistant/census/census-edit.php
index e1ebd64f8a..4c6cbbf6aa 100644
--- a/modules_v3/GEDFact_assistant/census/census-edit.php
+++ b/modules_v3/GEDFact_assistant/census/census-edit.php
@@ -218,11 +218,14 @@ $controller
/* Update the census text from the various input fields */
function updateCensusText() {
- var html = "";
- var title = jQuery("#Titl").val();
- var citation = jQuery("#citation").val();
- var locality = jQuery("#locality").val();
- var notes = jQuery("#notes").val();
+ var html = "";
+ var title = jQuery("#Titl").val();
+ var citation = jQuery("#citation").val();
+ var locality = jQuery("#locality").val();
+ var notes = jQuery("#notes").val();
+ var table = jQuery("#tblSample");
+ var max_col_ndx = table.find("thead th").length - 1;
+ var line = "";
if (title !== "") {
html += title + "\n";
@@ -236,24 +239,20 @@ $controller
html += "\n.start_formatted_area.\n";
- jQuery("#tblSample thead th").each(function(n, el) {
- if (n > 1) {
- html += "|";
- }
- if (n > 0) {
- html += ".b." + jQuery(el).html();
- }
+ table.find("thead th").each(function (n, el) {
+ if (n === 0 || n === max_col_ndx) { // Skip prefix & suffix cells
+ return true;
+ }
+ line += "|.b." + jQuery(el).html();
});
- html += "\n";
+ html += line.substr(1) + "\n";
- jQuery("#tblSample tbody tr").each(function(n, el) {
+ table.find("tbody tr").each(function(n, el) {
+ line = "";
jQuery("input", jQuery(el)).each(function(n, el) {
- if (n > 0) {
- html += "|";
- }
- html += jQuery(el).val();
+ line += "|" + jQuery(el).val();
});
- html += "\n";
+ html += line.substr(1) + "\n";
});
html += ".end_formatted_area.\n";
@@ -265,7 +264,7 @@ $controller
jQuery("#NOTE").val(html);
var pid_array = '';
- jQuery("#tblSample tbody td:first-child").each(function(n, el) {
+ table.find("tbody td:first-child").each(function(n, el) {
if (n > 0) {
pid_array += ',';
}
diff --git a/themes/clouds/css-1.7.4/style.css b/themes/clouds/css-1.7.4/style.css
index 1517aab0d0..66e207312d 100644
--- a/themes/clouds/css-1.7.4/style.css
+++ b/themes/clouds/css-1.7.4/style.css
@@ -2035,6 +2035,8 @@ dd .deletelink {
clear: both;
}
+/* ===== markdown formatting ===== */
+
.markdown p {
margin: 0 0 0.5em;
white-space: pre-wrap;
@@ -2155,6 +2157,20 @@ dd .deletelink {
clear: both;
}
+#notes_content .facts_table,
+#personal_facts_content .facts_table {
+ table-layout: fixed;
+}
+
+#notes_content > div,
+#personal_facts_content > div {
+ margin: 2px 2px 0;
+}
+
+.census-assistant-note {
+ overflow-x: auto;
+}
+
.facts_table .field em {
margin-top: 0;
padding-left: 5px;
@@ -3198,12 +3214,6 @@ dd .deletelink {
left: auto;
}
-/* ===== Census assistant module ===== */
-table.table-census-assistant th {
- font-weight: bold;
- text-align: left;
-}
-
/* Stories module */
.story_title {
padding-top: 12px;
diff --git a/themes/colors/css-1.7.4/style.css b/themes/colors/css-1.7.4/style.css
index 88e7bb331e..677ecb5918 100644
--- a/themes/colors/css-1.7.4/style.css
+++ b/themes/colors/css-1.7.4/style.css
@@ -2039,6 +2039,8 @@ dd .deletelink {
clear: both;
}
+/* ===== markdown formatting ===== */
+
.markdown p {
margin: 0 0 0.5em;
white-space: pre-wrap;
@@ -2159,6 +2161,20 @@ dd .deletelink {
clear: both;
}
+#notes_content .facts_table,
+#personal_facts_content .facts_table {
+ table-layout: fixed;
+}
+
+#notes_content > div,
+#personal_facts_content > div {
+ margin: 2px 2px 0;
+}
+
+.census-assistant-note {
+ overflow-x: auto;
+}
+
.facts_table .field em {
margin-top: 0;
padding-left: 5px;
@@ -3196,12 +3212,6 @@ dd .deletelink {
left: auto;
}
-/* ===== Census assistant module ===== */
-table.table-census-assistant th {
- font-weight: bold;
- text-align: left;
-}
-
/* Stories module */
.story_title {
padding-top: 12px;
diff --git a/themes/fab/css-1.7.4/style.css b/themes/fab/css-1.7.4/style.css
index 9eee53f875..4df561be0c 100644
--- a/themes/fab/css-1.7.4/style.css
+++ b/themes/fab/css-1.7.4/style.css
@@ -1953,6 +1953,8 @@ dd .deletelink {
clear: both;
}
+/* ===== markdown formatting ===== */
+
.markdown p {
margin: 0 0 0.5em;
white-space: pre-wrap;
@@ -2074,6 +2076,20 @@ dd .deletelink {
clear: both;
}
+#notes_content .facts_table,
+#personal_facts_content .facts_table {
+ table-layout: fixed;
+}
+
+#notes_content > div,
+#personal_facts_content > div {
+ margin: 2px 2px 0;
+}
+
+.census-assistant-note {
+ overflow-x: auto;
+}
+
.facts_table .field em {
margin-top: 0;
padding-left: 5px;
@@ -3137,12 +3153,6 @@ dd .deletelink {
left: auto;
}
-/* ===== Census assistant module ===== */
-table.table-census-assistant th {
- font-weight: bold;
- text-align: left;
-}
-
/* Stories module */
.story_title {
padding-top: 12px;
diff --git a/themes/minimal/css-1.7.4/style.css b/themes/minimal/css-1.7.4/style.css
index 7dbfa86e13..02f98c749b 100644
--- a/themes/minimal/css-1.7.4/style.css
+++ b/themes/minimal/css-1.7.4/style.css
@@ -1960,6 +1960,8 @@ dd .deletelink {
clear: both;
}
+/* ===== markdown formatting ===== */
+
.markdown p {
margin: 0 0 0.5em;
white-space: pre-wrap;
@@ -2060,6 +2062,20 @@ dd .deletelink {
clear: both;
}
+#notes_content .facts_table,
+#personal_facts_content .facts_table {
+ table-layout: fixed;
+}
+
+#notes_content > div,
+#personal_facts_content > div {
+ margin: 2px 2px 0;
+}
+
+.census-assistant-note {
+ overflow-x: auto;
+}
+
.facts_table .field em {
margin-top: 0;
padding-left: 5px;
@@ -3123,12 +3139,6 @@ dd .deletelink {
left: auto;
}
-/* ===== Census assistant module ===== */
-table.table-census-assistant th {
- font-weight: bold;
- text-align: left;
-}
-
/* Stories module */
.story_title {
padding-top: 12px;
diff --git a/themes/webtrees/css-1.7.4/style.css b/themes/webtrees/css-1.7.4/style.css
index 8500eaa2e8..03412969e8 100644
--- a/themes/webtrees/css-1.7.4/style.css
+++ b/themes/webtrees/css-1.7.4/style.css
@@ -1950,6 +1950,8 @@ dd .deletelink {
clear: both;
}
+/* markdown formatting ===== */
+
.markdown p {
margin: 0 0 0.5em;
white-space: pre-wrap;
@@ -2070,6 +2072,20 @@ dd .deletelink {
clear: both;
}
+#notes_content .facts_table,
+#personal_facts_content .facts_table {
+ table-layout: fixed;
+}
+
+#notes_content > div,
+#personal_facts_content > div {
+ margin: 2px 2px 0;
+}
+
+.census-assistant-note {
+ overflow-x: auto;
+}
+
.facts_table .field em {
margin-top: 0;
padding-left: 5px;
@@ -3096,12 +3112,6 @@ dd .deletelink {
left: auto;
}
-/* ===== Census assistant module ===== */
-table.table-census-assistant th {
- font-weight: bold;
- text-align: left;
-}
-
/* Stories module */
.story_title {
padding-top: 12px;
@@ -5224,7 +5234,7 @@ footer {
right: 0;
}
[dir=rtl] .secondary-menu {
- left: 0px;
+ left: 0;
right: auto;
}
/* Primary Menu */
diff --git a/themes/xenea/css-1.7.4/style.css b/themes/xenea/css-1.7.4/style.css
index 70e80b7fc4..4136ae338a 100644
--- a/themes/xenea/css-1.7.4/style.css
+++ b/themes/xenea/css-1.7.4/style.css
@@ -1964,6 +1964,8 @@ dd .deletelink {
clear: both;
}
+/* ===== markdown formatting ===== */
+
.markdown p {
margin: 0 0 0.5em;
white-space: pre-wrap;
@@ -2084,6 +2086,20 @@ dd .deletelink {
clear: both;
}
+#notes_content .facts_table,
+#personal_facts_content .facts_table {
+ table-layout: fixed;
+}
+
+#notes_content > div,
+#personal_facts_content > div {
+ margin: 2px 2px 0;
+}
+
+.census-assistant-note {
+ overflow-x: auto;
+}
+
.facts_table .field em {
margin-top: 0;
padding-left: 5px;
@@ -3115,12 +3131,6 @@ dd .deletelink {
left: auto;
}
-/* ===== Census assistant module ===== */
-table.table-census-assistant th {
- font-weight: bold;
- text-align: left;
-}
-
/* Stories module */
.story_title {
padding-top: 12px;