summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2013-07-05 22:09:39 +0000
committerfisharebest <fisharebest@gmail.com>2013-07-05 22:09:39 +0000
commit11c7bec9fe404966bedcec618fc461449cd5fa57 (patch)
treee7e37221213b8d278f4a774cf6bf084d11bf362f
parent9800a2b9bed0709fbf9679682318c1019c07cd55 (diff)
downloadwebtrees-11c7bec9fe404966bedcec618fc461449cd5fa57.tar.gz
webtrees-11c7bec9fe404966bedcec618fc461449cd5fa57.tar.bz2
webtrees-11c7bec9fe404966bedcec618fc461449cd5fa57.zip
Fix bugs - edit raw gedcom
-rw-r--r--edit_interface.php2
-rw-r--r--includes/functions/functions_edit.php33
-rw-r--r--includes/functions/functions_print_facts.php32
3 files changed, 28 insertions, 39 deletions
diff --git a/edit_interface.php b/edit_interface.php
index 06cab762c2..eee73b4990 100644
--- a/edit_interface.php
+++ b/edit_interface.php
@@ -153,7 +153,7 @@ case 'updateraw':
$gedcom = preg_replace('/\n\n+/', "\n", $gedcom); // Empty lines
$gedcom = trim($gedcom); // Leading/trailing spaces
- $record->updateRecord($gedcom, !$keep_chan);
+ $record->updateFact($fact_id, $gedcom, !$keep_chan);
$controller->addInlineJavascript('closePopupAndReloadParent();');
break;
diff --git a/includes/functions/functions_edit.php b/includes/functions/functions_edit.php
index 43fff5c5d8..dd8055010c 100644
--- a/includes/functions/functions_edit.php
+++ b/includes/functions/functions_edit.php
@@ -859,14 +859,27 @@ function add_simple_tag($tag, $upperlevel='', $label='', $readOnly='', $noClose=
$date=new WT_Date($value);
echo $date->Display(false);
}
- if (($fact=='ASSO' || $fact=='_ASSO' || $fact=='SOUR' || $fact=='OBJE' || ($fact=='NOTE' && $islink)) && $value) {
- $record=WT_GedcomRecord::getInstance($value);
- if ($record) {
- echo ' ', $record->getFullName();
- } elseif ($value!='new') {
- echo ' ', $value;
+ if ($value && $value!='new' && $islink) {
+ switch ($fact) {
+ case 'ASSO':
+ case 'ASSO':
+ echo ' ', WT_Individual::getInstance($value)->getFullname();
+ break;
+ case 'SOUR':
+ echo ' ', WT_Source::getInstance($value)->getFullname();
+ break;
+ case 'NOTE':
+ echo ' ', WT_Note::getInstance($value)->getFullname();
+ break;
+ case 'OBJE':
+ echo ' ', WT_Media::getInstance($value)->getFullname();
+ break;
+ case 'REPO':
+ echo ' ', WT_Repository::getInstance($value)->getFullname();
+ break;
}
}
+
// pastable values
if ($readOnly=='') {
if ($fact=='FORM' && $upperlevel=='OBJE') print_autopaste_link($element_id, $FILE_FORM_accept);
@@ -877,13 +890,9 @@ function add_simple_tag($tag, $upperlevel='', $label='', $readOnly='', $noClose=
return $element_id;
}
-/**
-* prints collapsable fields to add ASSO/RELA, SOUR, OBJE ...
-*
-* @param string $tag Gedcom tag name
-*/
+// prints collapsable fields to add ASSO/RELA, SOUR, OBJE ...
function print_add_layer($tag, $level=2) {
- global $MEDIA_DIRECTORY, $TEXT_DIRECTION, $gedrec, $FULL_SOURCES, $islink;
+ global $FULL_SOURCES;
if ($tag=='OBJE' && get_gedcom_setting(WT_GED_ID, 'MEDIA_UPLOAD') < WT_USER_ACCESS_LEVEL) {
return;
diff --git a/includes/functions/functions_print_facts.php b/includes/functions/functions_print_facts.php
index 66662fbcd8..9e3105c8cf 100644
--- a/includes/functions/functions_print_facts.php
+++ b/includes/functions/functions_print_facts.php
@@ -220,7 +220,7 @@ function print_fact(WT_Fact $fact, WT_GedcomRecord $record) {
// Print the value of this fact/event
switch ($fact->getTag()) {
case 'ADDR':
- print_address_structure($fact->getGedcom(), 1);
+ echo $fact->getValue();
break;
case 'AFN':
echo '<div class="field"><a href="https://familysearch.org/search/tree/results#count=20&query=afn:', rawurlencode($fact->getValue()), '" target="new">', htmlspecialchars($fact->getValue()), '</a></div>';
@@ -320,7 +320,11 @@ function print_fact(WT_Fact $fact, WT_GedcomRecord $record) {
echo '<div class="place">', format_fact_place($fact, true, true, true), '</div>';
// A blank line between the primary attributes (value, date, place) and the secondary ones
echo '<br>';
- print_address_structure($fact->getGedcom(), 2);
+
+ $addr = $fact->getAttribute('ADDR');
+ if ($addr) {
+ echo WT_Gedcom_Tag::getLabelValue('ADDR', $addr);
+ }
// Print the associates of this fact/event
print_asso_rela_record($fact, $record);
@@ -454,7 +458,6 @@ function print_repository_record($xref) {
$repository=WT_Repository::getInstance($xref);
if ($repository && $repository->canShow()) {
echo '<a class="field" href="', $repository->getHtmlUrl(), '">', $repository->getFullName(), '</a><br>';
- print_address_structure($repository->getGedcom(), 1);
echo '<br>';
print_fact_notes($repository->getGedcom(), 1);
}
@@ -579,11 +582,6 @@ function print_media_links($factrec, $level, $pid='') {
// NOTE: echo the notes of the media
echo '<p>';
echo print_fact_notes($media->getGedcom(), 1);
- if (preg_match('/2 DATE (.+)/', get_sub_record('FILE', 1, $media->getGedcom()), $match)) {
- $media_date=new WT_Date($match[1]);
- $md = $media_date->Display(true);
- echo '<p class="label">', WT_Gedcom_Tag::getLabel('DATE'), ': </p> ', $md;
- }
$ttype = preg_match("/".($nlevel+1)." TYPE (.*)/", $media->getGedcom(), $match);
if ($ttype>0) {
$mediaType = WT_Gedcom_Tag::getFileFormTypeValue($match[1]);
@@ -622,24 +620,6 @@ function print_media_links($factrec, $level, $pid='') {
$objectNum ++;
}
}
-/**
- * print an address structure
- *
- * takes a gedcom ADDR structure and prints out a human readable version of it.
- * @param string $factrec The ADDR subrecord
- * @param int $level The gedcom line level of the main ADDR record
- */
-function print_address_structure($factrec, $level) {
- if (preg_match("/$level ADDR (.*)/", $factrec, $omatch)) {
- $arec = get_sub_record($level, "$level ADDR", $factrec, 1);
- $cont = get_cont($level+1, $arec);
- $resultText = $omatch[1] . get_cont($level+1, $arec);
- if ($level>1) {
- $resultText = '<span class="label">'.WT_Gedcom_Tag::getLabel('ADDR').': </span><br><div class="indent">' . $resultText . '</div>';
- }
- echo $resultText;
- }
-}
// Print a row for the sources tab on the individual page
function print_main_sources(WT_Fact $fact, $level) {