Exemplo n.º 1
0
 /**
  * Return xml elements from data in request
  * @param unknown $request
  */
 protected function fromEditFields($request)
 {
     $result = $this->addSingleLineFieldToXml($this->correctPlaceTitle($request->getVal('place')), 'place') . $this->addSingleLineFieldToXml($request->getVal('url'), 'url') . $this->addSingleLineFieldToXml($request->getVal('phone'), 'phone') . $this->addSingleLineFieldToXml($request->getVal('postal_address'), 'postal_address');
     return $result;
 }
Exemplo n.º 2
0
 /**
  * Return xml elements from data in request
  * @param unknown $request
  */
 protected function fromEditFields($request)
 {
     $this->correctedPlaceTitles = PlaceSearcher::correctPlaceTitlesMultiLine($request->getVal('places', ''));
     $result = '';
     $result .= $this->addSingleLineFieldToXml($request->getVal('source'), 'source');
     $result .= $this->addMultiLineFieldToXml($request->getVal('surnames', ''), 'formatSurname');
     $result .= $this->addMultiLineFieldToXml($request->getVal('places', ''), 'formatPlace');
     $result .= $this->addSingleLineFieldToXml($request->getVal('fromYear', ''), 'from_year');
     $result .= $this->addSingleLineFieldToXml($request->getVal('toYear', ''), 'to_year');
     return $result;
 }
Exemplo n.º 3
0
 /**
  * Import data from additional edit fields into the main edit field
  * Calls the abstract function fromEditFields($request)
  * @param EditPage $editPage
  * @param unknown $request
  */
 public function importEditData($editPage, $request)
 {
     if ($request->wasPosted() && !$editPage->section && !$request->getVal('xml')) {
         $editPage->textbox1 = $this->getEditText($request, $editPage->textbox1);
     }
 }
Exemplo n.º 4
0
 /**
  * Return xml elements from data in request
  * @param unknown $request
  */
 protected function fromEditFields($request)
 {
     $this->correctedPlaceTitles = PlaceSearcher::correctPlaceTitlesMultiLine($request->getVal('places', ''));
     $result = '';
     // !!! +title, +date_issued, -publication_info, -call_number, type->format, -abbrev, +ethnicity, +religion, +occupation, +category
     // !!! author format=lastname, given name(s)
     if ($this->isGedcomPage) {
         list($mysourcePrefix, $mysourceTitle, $mysourceSuffix) = MySource::splitGedcomMySourceTitle($this->titleString);
         $mysourceTitle = $request->getVal('mysource_title', '') ? $request->getVal('mysource_title', '') : $mysourceTitle;
         $mysourceTitle = mb_strtoupper(mb_substr($mysourceTitle, 0, 1)) . mb_substr($mysourceTitle, 1);
         $result .= $this->addSingleLineFieldToXml($mysourceTitle, 'title');
         $this->titleString = $mysourcePrefix . $mysourceTitle . $mysourceSuffix;
         $this->title = Title::newFromText($this->titleString, NS_MYSOURCE);
     }
     $result .= $this->addSingleLineFieldToXml($this->cleanUrl($request->getVal('url', '')), 'url');
     //      $result .= $this->addMultiLineFieldToXml($request->getVal('altNames', ''), 'formatAltNameXML');
     $result .= $this->addMultiLineFieldToXml($request->getVal('places', ''), 'formatPlace');
     $result .= $this->addMultiLineFieldToXml($request->getVal('surnames', ''), 'formatSurname');
     $result .= $this->addSingleLineFieldToXml($request->getVal('fromYear', ''), 'from_year');
     $result .= $this->addSingleLineFieldToXml($request->getVal('toYear', ''), 'to_year');
     $result .= $this->addSingleLineFieldToXml($request->getVal('abbrev', ''), 'abbrev');
     $result .= $this->addSingleLineFieldToXml($request->getVal('author', ''), 'author');
     $result .= $this->addSingleLineFieldToXml($request->getVal('pubInfo', ''), 'publication_info');
     $result .= $this->addSingleLineFieldToXml($request->getVal('callNumber', ''), 'call_number');
     $result .= $this->addSingleLineFieldToXml($request->getVal('type', ''), 'type');
     $result .= $this->addSingleLineFieldToXml($request->getVal('repoName', ''), 'repository_name');
     $result .= $this->addSingleLineFieldToXml($request->getVal('repoAddr', ''), 'repository_addr');
     return $result;
 }
Exemplo n.º 5
0
 /**
  * Return xml elements from data in request
  * @param unknown $request
  */
 protected function fromEditFields($request)
 {
     $related = $request->getVal('related', '');
     $search = array('/ *\\r?\\n */', '/\\|/');
     // add space before bar so things sort right
     $replace = array("\n", ' |');
     $related = trim(preg_replace($search, $replace, $related));
     $relNames = preg_split('/[\\n]+/', $related, -1, PREG_SPLIT_NO_EMPTY);
     sort($relNames, SORT_STRING);
     $prevName = '';
     $result = '';
     foreach ($relNames as $relName) {
         $fields = explode('|', $relName, 2);
         $name = StructuredData::escapeXml(StructuredData::standardizeNameCase(trim(@$fields[0]), false));
         $source = StructuredData::escapeXml(trim(@$fields[1]));
         // remove any space before bar in source: links that would have been added above
         $source = str_replace(' |', '|', $source);
         if ($name != $prevName) {
             $result .= "<related name=\"{$name}\" source=\"{$source}\"/>\n";
         }
         $prevName = $name;
     }
     return $result;
 }
Exemplo n.º 6
0
 /**
  * Return xml elements from data in request
  * @param unknown $request
  */
 protected function fromEditFields($request)
 {
     //		wfDebug("WR:FromEditFields\n");
     $result = '';
     //        $result .= $this->addSingleLineFieldToXml($this->cleanPrefName($request->getVal('preferredName', '')), 'preferred_name');
     $result .= $this->addMultiLineFieldToXml($request->getVal('alternateNames', ''), 'formatAlternateNameElement');
     $placeType = Place::capitalizeType($request->getVal('type', ''));
     if (!$placeType) {
         $placeType = 'Unknown';
     }
     $result .= $this->addSingleLineFieldToXml($placeType, 'type');
     $lat = $this->parseLatLng($request->getVal('latitude', ''), true);
     $lng = $this->parseLatLng($request->getVal('longitude', ''), false);
     $result .= $this->addSingleLineFieldToXml($lat, 'latitude');
     $result .= $this->addSingleLineFieldToXml($lng, 'longitude');
     $result .= $this->addSingleLineFieldToXml($request->getVal('fromYear', ''), 'from_year');
     $result .= $this->addSingleLineFieldToXml($request->getVal('toYear', ''), 'to_year');
     $result .= $this->addMultiLineFieldToXml($request->getVal('alsoLocatedIn', ''), 'formatAlsoLocatedInElement');
     $result .= $this->addMultiLineFieldToXml($request->getVal('seeAlso', ''), 'formatSeeAlsoElement');
     $result .= $this->getContainedPlacesElements();
     return $result;
 }
Exemplo n.º 7
0
 /**
  * Return xml elements from data in request
  * @param unknown $request
  */
 protected function fromEditFields($request)
 {
     $result = '';
     $this->loadPages();
     $result .= $this->addSingleLineFieldToXml($request->getVal('license', ''), 'license');
     $result .= $this->addSingleLineFieldToXml($request->getVal('copyright_holder', ''), 'copyright_holder');
     $result .= $this->addSingleLineFieldToXml($request->getVal('date', ''), 'date');
     $result .= $this->addSingleLineFieldToXml($this->correctPlaceTitle($request->getVal('place')), 'place');
     $result .= $this->fromPage($request, 'person', NS_PERSON);
     $result .= $this->fromPage($request, 'family', NS_FAMILY);
     $result .= preg_replace('/\\r?\\n/', "\n", $request->getVal('notes', '')) . "\n";
     $this->clearPages();
     return $result;
 }
Exemplo n.º 8
0
 /**
  * Return xml elements from data in request
  * @param unknown $request
  */
 protected function fromEditFields($request)
 {
     $this->correctedPlaceTitles = PlaceSearcher::correctPlaceTitlesMultiLine($request->getVal('places', ''));
     $subjects = $request->getArray('subject', array());
     $sourceType = $request->getVal('source_type', '');
     $result = $this->addSingleLineFieldToXml($sourceType, 'source_type') . (!$sourceType || in_array($sourceType, array('Book', 'Article', 'Government / Church records', 'Periodical', 'Manuscript collection', 'Website', 'Miscellaneous', 'MySource')) ? $this->addMultiLineFieldToXml($request->getVal('authors', ''), 'formatAuthor') : '') . $this->addSingleLineFieldToXml($request->getVal('source_title', ''), 'source_title') . (!$sourceType || in_array($sourceType, array('Book', 'Article', 'Government / Church records', 'Manuscript collection', 'Website', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('subtitle', ''), 'subtitle') : '') . (!$sourceType || in_array($sourceType, array('Book', 'Article', 'Government / Church records', 'Periodical', 'Manuscript collection', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('publisher', ''), 'publisher') : '') . (!$sourceType || in_array($sourceType, array('Book', 'Article', 'Government / Church records', 'Manuscript collection', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('date_issued', ''), 'date_issued') : '') . (!$sourceType || in_array($sourceType, array('Book', 'Government / Church records', 'Newspaper', 'Periodical', 'Manuscript collection', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('place_issued', ''), 'place_issued') : '') . (!$sourceType || in_array($sourceType, array('Book', 'Article', 'Government / Church records', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('series_name', ''), 'series_name') : '') . (!$sourceType || in_array($sourceType, array('Book', 'Article', 'Government / Church records', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('volumes', ''), 'volumes') : '') . (!$sourceType || in_array($sourceType, array('Article', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('pages', ''), 'pages') : '') . (!$sourceType || in_array($sourceType, array('Book', 'Article', 'Government / Church records', 'Miscellaneous', 'MySource')) ? $this->addSingleLineFieldToXml($request->getVal('references', ''), 'references') : '') . $this->addMultiLineFieldToXml($request->getVal('surnames', ''), 'formatSurname') . $this->addMultiLineFieldToXml($request->getVal('places', ''), 'formatPlace') . $this->addSingleLineFieldToXml($request->getVal('fromYear', ''), 'from_year') . $this->addSingleLineFieldToXml($request->getVal('toYear', ''), 'to_year') . $this->addMultiLineFieldToXml($subjects, 'formatSubject') . (in_array('Ethnic/Cultural', $subjects) ? $this->addSingleLineFieldToXml($request->getVal('ethnicity', ''), 'ethnicity') : '') . (in_array('Church records', $subjects) ? $this->addSingleLineFieldToXml($request->getVal('religion', ''), 'religion') : '') . (in_array('Occupation', $subjects) ? $this->addSingleLineFieldToXml($request->getVal('occupation', ''), 'occupation') : '');
     for ($i = 0; $request->getVal("repository_id{$i}"); $i++) {
         $title = trim($request->getVal("repository_title{$i}"));
         $location = trim($request->getVal("repository_location{$i}"));
         $availability = trim($request->getVal("availability{$i}"));
         if ($title || $location) {
             $result .= $this->addMultiAttrFieldToXml(array('title' => $title, 'source_location' => $location, 'availability' => $availability), 'repository');
         }
     }
     return $result;
 }
Exemplo n.º 9
0
 /**
  * Return xml elements from data in request
  * @param unknown $request
  */
 protected function fromEditFields($request)
 {
     $this->correctedPlaceTitles = PlaceSearcher::correctPlaceTitlesMultiLine($request->getVal('places', ''));
     $result = '';
     if ($this->isSubpage) {
         $result .= $this->addMultiLineFieldToXml($request->getVal('surnames', ''), 'formatSurname');
         $result .= $this->addMultiLineFieldToXml($request->getVal('places', ''), 'formatPlace');
         $result .= $this->addSingleLineFieldToXml($request->getVal('fromYear', ''), 'from_year');
         $result .= $this->addSingleLineFieldToXml($request->getVal('toYear', ''), 'to_year');
     } else {
         $placesToCorrect = array();
         for ($i = 0; $request->getVal("researching_id{$i}"); $i++) {
             $place = trim($request->getVal("researching_place{$i}"));
             if ($place && mb_strpos($place, '|') === false) {
                 $placesToCorrect[] = $place;
             }
         }
         $correctedPlaceTitles = PlaceSearcher::correctPlaceTitles($placesToCorrect);
         for ($i = 0; $request->getVal("researching_id{$i}"); $i++) {
             $surname = StructuredData::standardizeNameCase(trim($request->getVal("researching_surname{$i}")), false);
             $place = trim($request->getVal("researching_place{$i}"));
             if ($surname || $place) {
                 // if you change this, you must also change FamilyTreeAjaxFunctions
                 if ($place) {
                     $correctedPlace = @$correctedPlaceTitles[$place];
                     if ($correctedPlace) {
                         $place = $correctedPlace;
                     }
                 }
                 $result .= $this->addMultiAttrFieldToXml(array('surname' => $surname, 'place' => $place), 'researching');
             }
         }
     }
     return $result;
 }