Skip to content

Commit

Permalink
Merge pull request #914 from fraggle-DE/RED-1316_use_solved_coordinat…
Browse files Browse the repository at this point in the history
…es_as_main_coordinates_in_GPX-export

RED-1316 use solved coordinates in GPX-export
  • Loading branch information
teiling88 committed Jan 17, 2024
2 parents df8e897 + 1b194e3 commit e786ef2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
14 changes: 9 additions & 5 deletions htdocs/lib2/search/search.gpx.inc.php
Expand Up @@ -634,17 +634,21 @@ function search_output(): void
$waypoints .= $thiswp . "\n";
++$n;
}

// if user has entered solved coordinates, handle them with a separate waypoint
// original cache coordinates are stored in this waypoint as ORIGINAL
// original cache coordinates will be overwritten with solved coordinates
if ($cacheNote && !empty($cacheNote['latitude']) && !empty($cacheNote['longitude'])) {
$thiswp = $gpxWaypoints;
$thiswp = mb_ereg_replace('{wp_lat}', sprintf('%01.5f', $cacheNote['latitude']), $thiswp);
$thiswp = mb_ereg_replace('{wp_lon}', sprintf('%01.5f', $cacheNote['longitude']), $thiswp);
$thiswp = mb_ereg_replace('{wp_lat}', sprintf('%01.5f', $lat), $thiswp); // take $lat as original coordinates
$thiswp = mb_ereg_replace('{wp_lon}', sprintf('%01.5f', $lon), $thiswp); // $lon the same..
$thisline = mb_ereg_replace(sprintf('%01.5f', $lat), $cacheNote['latitude'], $thisline); // replace already replaced original coordinates with solved coordinates
$thisline = mb_ereg_replace(sprintf('%01.5f', $lon), $cacheNote['longitude'], $thisline); // ..
$thiswp = mb_ereg_replace('{time}', $time, $thiswp);
$thiswp = mb_ereg_replace('{name}', $r['waypoint'] . 'NOTE', $thiswp);
$thiswp = mb_ereg_replace('{name}', $r['waypoint'] . 'ORIGINAL', $thiswp);
$thiswp = mb_ereg_replace('{cachename}', text_xmlentities($r['name']), $thiswp);
$thiswp = mb_ereg_replace('{comment}', text_xmlentities($cacheNote['note']), $thiswp);
$thiswp = mb_ereg_replace('{desc}', text_xmlentities($cache_note_text), $thiswp);
$thiswp = mb_ereg_replace('{type}', 'Reference Point', $thiswp);
$thiswp = mb_ereg_replace('{type}', 'Original Coordinates', $thiswp);
$thiswp = mb_ereg_replace('{parent}', $r['waypoint'], $thiswp);
$thiswp = mb_ereg_replace('{cacheid}', $r['cacheid'], $thiswp);
$waypoints .= $thiswp . "\n";
Expand Down
24 changes: 15 additions & 9 deletions htdocs/search.php
Expand Up @@ -891,7 +891,7 @@
);
}
$r = sql_fetch_array($rs);

if ($r) {
$lat = $r['latitude'];
$lon = $r['longitude'];
Expand Down Expand Up @@ -1490,7 +1490,13 @@

$count = $caches_per_page;
if (isset($_REQUEST['count'])) { // Ocprop
$count = floor($_REQUEST['count'] + 0);
if ($_REQUEST['count'] === 'max') {
$count = 'max';
}
else
{
$count = floor($_REQUEST['count'] + 0);
}
}
if ($count == 'max') {
$count = 500;
Expand Down Expand Up @@ -1890,7 +1896,7 @@ function outputSearchForm($options)
$tpl->assign('searchtype_byortplz', in_array($options['searchtype'], ['byplz', 'byort']));
$tpl->assign('searchtype_bywaypoint', $options['searchtype'] == 'bywaypoint');
$tpl->assign('searchtype_bycoords', $options['searchtype'] == 'bycoords');

// owner
$tpl->assign('owner', isset($options['owner']) ? htmlspecialchars($options['owner'], ENT_COMPAT, 'UTF-8') : '');
$tpl->assign('searchtype_byowner', $options['searchtype'] == 'byowner');
Expand Down Expand Up @@ -2121,7 +2127,7 @@ function outputSearchForm($options)
$group_img
);

if ($bBeginLine2 == true) {
if ($bBeginLine2) {
$attributes_img2 .= '<div id="attribs2">';
$bBeginLine2 = false;
}
Expand All @@ -2133,7 +2139,7 @@ function outputSearchForm($options)
}
}
sql_free_result($rsAttrGroup);
if ($bBeginLine2 == false) {
if (!$bBeginLine2) {
$attributes_img2 .= '</div>';
}

Expand Down Expand Up @@ -2229,7 +2235,7 @@ function outputSearchForm($options)
$group_img
);

if ($bBeginLine1 == true) {
if ($bBeginLine1) {
$attributes_img1 .= '<div id="attribs1">';
$bBeginLine1 = false;
}
Expand All @@ -2241,7 +2247,7 @@ function outputSearchForm($options)
}
}
sql_free_result($rsAttrGroup);
if ($bBeginLine1 == false) {
if (!$bBeginLine1) {
$attributes_img1 .= '</div>';
}

Expand Down Expand Up @@ -2287,7 +2293,7 @@ function outputSearchForm($options)

//all
$tpl->assign('searchtype_byall', $options['searchtype'] == 'all');

// error messages
$tpl->assign('ortserror', '');
if (isset($options['error_plz'])) {
Expand Down Expand Up @@ -2573,7 +2579,7 @@ function outputLocidSelectionForm($locSql, $options)
}

//add cache to cachelist
function addToList($list_caches)
function addToList($list_caches): int
{
global $login;
$added_waypoints = 0;
Expand Down
4 changes: 4 additions & 0 deletions htdocs/templates2/ocstyle/articles/DE/changelog.tpl
Expand Up @@ -77,6 +77,10 @@

<p id="additional"><strong>Zusätzliche Änderungen</strong></p>
<ul>
<li>20.11.2023 - betrifft nur GPX-Export: geänderte Koordinaten werden zu Listingkoordinaten. Originale Ankerkoordinaten werden als separater Wegpunkt in der GPX-Datei vermerkt.</li>
<li>01.11.2022 - 'Teilgenommen'-Logs zählen nun für die Berechnung der Empfehlungen</li>
<li>01.06.2022 - Neues Design für Attribute-Icons</li>
<li>01.05.2022 - Neues Design für Cache-Icons</li>
<li>03.12.2018 - Caches im Profil werden nach letztem Fund sortiert</li>
<li>30.11.2018 - Minikarte bei Safaries durch Globi ersetzt</li>
<li>Einführung Symfony</li>
Expand Down
4 changes: 4 additions & 0 deletions htdocs/templates2/ocstyle/articles/EN/changelog.tpl
Expand Up @@ -23,6 +23,10 @@

<p id="additional"><strong>Additional Changes</strong></p>
<ul>
<li>20.11.2023 - GPX export of listings: 'changed coordinates' become listing coordinates. Original listing coordinates are saved as separate waypoint.</li>
<li>01.11.2022 - 'Attended' logs count for calculation of recommendations</li>
<li>01.06.2022 - newly designed attribute icons</li>
<li>01.05.2022 - newly designed cache icons</li>
<li>03.12.2018 - caches on profil page are sorted by last found date</li>
<li>30.11.2018 - replace minimap with globi on safari cache listings</li>
<li>integration of symfony</li>
Expand Down

0 comments on commit e786ef2

Please sign in to comment.