Skip to content

Commit

Permalink
add cache link to adoption message; closes opencaching#1950
Browse files Browse the repository at this point in the history
  • Loading branch information
following5 committed Feb 6, 2019
1 parent 82ae903 commit 1ba07b0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Controllers/CacheAdoptionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private function actionAccept(GeoCache $cacheObj)
$this->db->commit();

$message = tr('adopt_15');
$message = str_replace('{cacheName}', $cacheObj->getCacheName(), $message);
$message = str_replace('{cacheName}', $cacheObj->getLinkedName(), $message);
$this->infoMsg = $message;

EmailSender::sendAdoptionSuccessMessage(__DIR__.'/../tpl/stdstyle/email/adoption.email.html',
Expand Down
5 changes: 5 additions & 0 deletions Utils/View/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ public function setVar($varName, $varValue)
$this->$varName = $varValue;
}

public static function makeLink($uri, $plainText)
{
return '<a href="'.$uri.'">'.htmlspecialchars($plainText).'</a>';
}

public function __call($method, $args)
{
if (property_exists($this, $method) && is_callable($this->$method)) {
Expand Down
17 changes: 17 additions & 0 deletions lib/Objects/GeoCache/GeoCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use lib\Objects\User\User;
use Utils\EventHandler\EventHandler;
use Utils\I18n\I18n;
use Utils\Uri\SimpleRouter;
use Utils\View\View;

/**
* Description of geoCache
Expand Down Expand Up @@ -1706,4 +1708,19 @@ public static function nanoIsInUse()
self::SIZE_NANO
) != 0;
}

public function getAbsLink()
{
return SimpleRouter::getAbsLink('ViewCache') . '?wp=' . $this->getWaypointId();
}

public function getLinkedName()
{
return View::makeLink($this->getAbsLink(), $this->cacheName);
}

public function getLinkedWaypointId()
{
return View::makeLink($this->getAbsLink(), $this->geocacheWaypointId);
}
}
4 changes: 3 additions & 1 deletion tpl/stdstyle/cacheAdoption/chooseUser.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
</div>
<div>
<p>
<label for="username">{{adopt_07}}</label>
<input id="username" type="text" size="25" name="username" />
<input id="username" type="text" size="20" name="username" />
<input type="submit" class="btn btn-sm btn-primary" value="{{adopt_08}}" />
</p>
</div>
<input type="hidden" name ="cacheid" value="{cacheid}" />
Expand Down

0 comments on commit 1ba07b0

Please sign in to comment.