okapi r777: added gpx thumbnail images option

This commit is contained in:
following
2013-04-24 23:24:59 +02:00
parent 368911cf57
commit 7cacf8f489
5 changed files with 37 additions and 21 deletions

View File

@ -799,7 +799,7 @@ class Okapi
{
public static $data_store;
public static $server;
public static $revision = 769; # This gets replaced in automatically deployed packages
public static $revision = 777; # This gets replaced in automatically deployed packages
private static $okapi_vars = null;
/** Get a variable stored in okapi_vars. If variable not found, return $default. */

View File

@ -87,7 +87,7 @@ class WebService
$images = $request->get_parameter('images');
if (!$images) $images = 'descrefs:nonspoilers';
if (!in_array($images, array('none', 'descrefs:nonspoilers', 'descrefs:all', 'ox:all')))
if (!in_array($images, array('none', 'descrefs:thumblinks', 'descrefs:nonspoilers', 'descrefs:all', 'ox:all')))
throw new InvalidParam('images', "'$images'");
$vars['images'] = $images;

View File

@ -51,14 +51,20 @@
<p>Which images to include (and how to include them). One of the following values:</p>
<ul>
<li><b>none</b> - no images will be included,</li>
<li><b>descrefs:thumblinks</b> - all images will be included as "thumbnail"
&lt;img&gt; references at the end of each cache description, with a
replacement image used for spoilers; the thumbnails are linked to the
large images,</li>
<li><b>descrefs:nonspoilers</b> - all non-spoiler images will be included
as &lt;img&gt; references at the end of each cache description,</li>
as &lt;img&gt; references at the end of each cache description,</li>
<li><b>descrefs:all</b> - all images will be included (including spoilers)
as &lt;img&gt; references at the end of each cache description,</li>
as &lt;img&gt; references at the end of each cache description,</li>
<li><b>ox:all</b> - all images will be included (including spoilers)
as Garmin's &lt;ox:image&gt; references.</li>
as Garmin's &lt;ox:image&gt; references.</li>
</ul>
<p>Note: When using "descrefs:" mode, remember to set <b>ns_ground</b> to <b>true</b>.</p>
<p>Note: When using "descrefs:" mode, remember to set <b>ns_ground</b> to <b>true</b>.
The default value is "descrefs:nonspoilers" for compatibilty reasons, but for
most applications "descrefs:thumblinks" will be the better choice.</p>
<p>Note: When using "ox:" mode, remember to set <b>ns_ox</b> to <b>true</b>. You must also
include JPEG files along the GPX for this to work properly - see
services/caches/formatters/garmin for more information.</p>

View File

@ -71,27 +71,36 @@ http://www.gsak.net/xmlv1/5 http://www.gsak.net/xmlv1/5/gsak.xsd
&lt;/ul&gt;
<? } ?>
<?= Okapi::xmlescape($c['description']) ?>
<? if ((strpos($vars['images'], "descrefs:") === 0) && count($c['images']) > 0) { /* Does user want us to include <img> references in cache descriptions? */ ?>
<?
<? if ((strpos($vars['images'], "descrefs:") === 0) && count($c['images']) > 0) { /* Does user want us to include <img> references in cache descriptions? */
if ($vars['images'] == "descrefs:thumblinks") { ?>
&lt;h2&gt;<?= _("Images") ?> (<?= count($c['images']) ?>)&lt;/h2&gt;
&lt;div&gt;
<? foreach ($c['images'] as $img) { ?>
&lt;div style='float:left; padding:6px'&gt;&lt;a href='<?= Okapi::xmlescape($img['url']) ?>'&gt;&lt;img src='<?= Okapi::xmlescape($img['thumb_url']) ?>'&gt;&lt;/a&gt;&lt;br&gt;
<?= Okapi::xmlescape($img['caption']) ?>&lt;/div&gt;
<? } ?>
&lt;/div&gt;
<? } else {
# We will split images into two subcategories: spoilers and nonspoilers.
$spoilers = array();
$nonspoilers = array();
foreach ($c['images'] as $img)
if ($img['is_spoiler']) $spoilers[] = $img;
else $nonspoilers[] = $img;
?>
<? if (count($nonspoilers) > 0) { ?>
&lt;h2&gt;<?= _("Images") ?> (<?= count($nonspoilers) ?>)&lt;/h2&gt;
<? foreach ($nonspoilers as $img) { ?>
&lt;p&gt;&lt;img src='<?= Okapi::xmlescape($img['url']) ?>'&gt;&lt;br&gt;
<?= Okapi::xmlescape($img['caption']) ?>&lt;/p&gt;
?>
<? if (count($nonspoilers) > 0) { ?>
&lt;h2&gt;<?= _("Images") ?> (<?= count($nonspoilers) ?>)&lt;/h2&gt;
<? foreach ($nonspoilers as $img) { ?>
&lt;p&gt;&lt;img src='<?= Okapi::xmlescape($img['url']) ?>'&gt;&lt;br&gt;
<?= Okapi::xmlescape($img['caption']) ?>&lt;/p&gt;
<? } ?>
<? } ?>
<? } ?>
<? if (count($spoilers) > 0 && $vars['images'] == 'descrefs:all') { ?>
&lt;h2&gt;<?= _("Spoilers") ?> (<?= count($spoilers) ?>)&lt;/h2&gt;
<? foreach ($spoilers as $img) { ?>
&lt;p&gt;&lt;img src='<?= Okapi::xmlescape($img['url']) ?>'&gt;&lt;br&gt;
<?= Okapi::xmlescape($img['caption']) ?>&lt;/p&gt;
<? if (count($spoilers) > 0 && $vars['images'] == 'descrefs:all') { ?>
&lt;h2&gt;<?= _("Spoilers") ?> (<?= count($spoilers) ?>)&lt;/h2&gt;
<? foreach ($spoilers as $img) { ?>
&lt;p&gt;&lt;img src='<?= Okapi::xmlescape($img['url']) ?>'&gt;&lt;br&gt;
<?= Okapi::xmlescape($img['caption']) ?>&lt;/p&gt;
<? } ?>
<? } ?>
<? } ?>
<? } ?>

View File

@ -118,7 +118,8 @@
<li>
<p><b>willattends</b> - in case of Event Caches, this is the number of
"Will attend" log entries. In case of any other cache type, it will
be <b>null</b></p>
be <b>zero</b> (not null, for <a href='https://code.google.com/p/opencaching-api/issues/detail?id=233'>backward
compatibility</a>),</p>
</li>
<li class='deprecated'>
<b>size</b> - deprecated