Skip to content
Permalink
Browse files

added log picture gallery for own caches; updates #39 (#535)

* added log picture gallery for own caches; updates #39

* added cachename title to own caches log pic (displayed name can be truncated)
  • Loading branch information...
following5 authored and teiling88 committed Aug 26, 2017
1 parent 9492b7e commit 33637efa53318bedf059d4bb0aeedd0ae1519e00
@@ -17,9 +17,10 @@ class LogPics
const FOR_NEWPICS_GALLERY = 2;
const FOR_USER_STAT = 3;
const FOR_USER_GALLERY = 4; // params: userId
const FOR_MYHOME_GALLERY = 5;
const FOR_CACHE_STAT = 6; // params: cacheId
const FOR_CACHE_GALLERY = 7; // params: cacheId
const FOR_OWNLOGS_GALLERY = 5;
const FOR_OWNCACHES_GALLERY = 6;
const FOR_CACHE_STAT = 7; // params: cacheId
const FOR_CACHE_GALLERY = 8; // params: cacheId
const MAX_PICTURES_PER_GALLERY_PAGE = 48; // must be multiple of 6
@@ -147,7 +148,7 @@ public static function get($purpose, $userId = 0, $cacheId = 0)
);
break;
case self::FOR_MYHOME_GALLERY:
case self::FOR_OWNLOGS_GALLERY:
// all picture of one user, with the only exception of zombie pix hanging
// by an old log deletion (we should remove those ...)
@@ -159,7 +160,25 @@ public static function get($purpose, $userId = 0, $cacheId = 0)
ORDER BY `logs`.`order_date` DESC",
$login->userid
);
break;
case self::FOR_OWNCACHES_GALLERY:
// all picture for the caches of one user
$rs = sql(
"SELECT
$fields,
`user`.`username`,
`logs`.`date` AS `picdate`,
`caches`.`name` AS `cachename`
FROM `pictures` AS `pics`
$joinLogs
$joinCaches
$joinUser
WHERE `object_type`=1 AND `caches`.`user_id`='&1'
ORDER BY `logs`.`order_date` DESC",
$login->userid
);
break;
case self::FOR_CACHE_STAT:
@@ -131,14 +131,20 @@
// $tpl->assign('emails', sql_value("SELECT COUNT(*) FROM `email_user` WHERE `from_user_id`='&1'", 0, $login->userid));
// get log pictures
$allpics = isset($_REQUEST['allpics']) && $_REQUEST['allpics'];
$all_pictures = LogPics::get(LogPics::FOR_MYHOME_GALLERY);
if ($allpics) {
LogPics::setPaging(LogPics::FOR_MYHOME_GALLERY, 0, 0, "myhome.php?allpics=1");
$allpics = isset($_REQUEST['allpics']) ? $_REQUEST['allpics'] : false;
if ($allpics === '1') {
// downward compatibility for external or bookmarked links, see redmine #39 change
$allpics = 'ownlogs';
}
if ($allpics == 'ownlogs' || $allpics == 'owncaches') {
$gallery = ($allpics == 'ownlogs' ? LogPics::FOR_OWNLOGS_GALLERY : LogPics::FOR_OWNCACHES_GALLERY);
$all_pictures = LogPics::get($gallery);
LogPics::setPaging($gallery, 0, 0, "myhome.php?allpics=1");
} else {
$all_pictures = LogPics::get(LogPics::FOR_OWNLOGS_GALLERY);
$tpl->assign('pictures', $all_pictures);
}
$tpl->assign('allpics', $allpics ? 1 : 0);
$tpl->assign('allpics', $allpics);
$tpl->assign('total_pictures', count($all_pictures));
// display
@@ -60,7 +60,7 @@ function myHomeLoad()
{t 1=$login.username}Hello %1{/t}
</div>
{if !$allpics}
{if $allpics === false}
{* Geocaches found *}
<div class="content2-container bg-blue02" style="margin-top:20px;">
<p class="content-title-noshade-size3">
@@ -98,32 +98,42 @@ function myHomeLoad()
<p class="content-title-noshade-size3">
<img src="resource2/{$opt.template.style}/images/misc/32x32-pictures.gif" width="24" height="24" style="margin-right: 10px;" />&nbsp;
{t 1=$total_pictures}Log pictures: %1{/t} &nbsp;
{if $pictures|@count > 0 && !$allpics}<span class="content-title-link">[<a href="myhome.php?allpics=1">{t}Show all{/t}</a>]</span>{/if}
{if $pictures|@count > 0 && $allpics === false}<span class="content-title-link">[<a href="myhome.php?allpics=ownlogs">{t}Show all{/t}</a>]</span>{/if}
</p>
</div>
{if $pictures|@count == 0}
<p>{t}You did not upload any log pictures yet.{/t}</p>
{if $allpics == 'owncaches'}
<p>{t}There are no log pictures yet for your caches.{/t}</p>
{else}
<p>{t}You did not upload any log pictures yet.{/t}</p>
{/if}
<br />
{else}
<p style="line-height: 1.6em;">
{if !$allpics}
<b>{t}Your latest log pictures:{/t}</b></p>
{assign var=maxlines value=1}
{else}
{if $allpics == 'ownlogs'}
{assign var=subtitle value="{t}Your log pictures:{/t}"}
{assign var=maxlines value=0}
{elseif $allpics == 'owncaches'}
{assign var=subtitle value="{t}Log pictures for your caches:{/t}"}
{assign var=maxlines value=0}
{else}
<b>{t}Your latest log pictures:{/t}</b></p>
{assign var=maxlines value=1}
{/if}
</p>
{include file="res_logpictures.tpl" logdate=true loguser=false maxlines=$maxlines fullyear=true}
{if $allpics}
{if $allpics == 'owncaches'}
{include file="res_logpictures.tpl" logdate=true loguser=true maxlines=$maxlines fullyear=false}
{else}
{include file="res_logpictures.tpl" logdate=true loguser=false maxlines=$maxlines fullyear=true}
{/if}
{if $allpics == 'ownlogs'}
<p>{t}In your <a href="mydetails.php">profile settings</a> you can choose if your log pictures stat and gallery is visible for other users.{/t}</p>
{/if}
{/if}
{if !$allpics}
{if $allpics === false}
{* Geocaches hidden *}
<div class="content2-container bg-blue02" id="mycaches" style="margin-top:5px">
<p class="content-title-noshade-size3">
@@ -167,7 +177,12 @@ function myHomeLoad()
</tr>
{/foreach}
<tr><td class="spacer" colspan="3"></td></tr>
<tr><td colspan="3"><a class="systemlink" href="ownerlogs.php">{t}Show log history{/t}</a></td></tr>
<tr>
<td colspan="8">
<a class="systemlink" href="ownerlogs.php">{t}Log history{/t}</a>,
<a class="systemlink" href="myhome.php?allpics=owncaches">{t}Log pictures gallery{/t}</a>
</td>
</tr>
{/if}
{* ... unpublished caches *}
@@ -15,7 +15,7 @@
{else}
{assign var=dateformat value=$opt.format.dm}
{/if}
{if !$loguser}<a href="viewcache.php?cacheid={$picture.cache_id}&log=A#log{$picture.logid}">{/if}{$picture.picdate|date_format:$dateformat}{if !$loguser}</a>{/if}{/if}&nbsp;{if $loguser}<a href="{if $profilelink}viewprofile.php?userid={$picture.user_id}{else}viewcache.php?cacheid={$picture.cache_id}&log=A#log{$picture.logid}{/if}">{$picture.username|escape}</a>
{if !$loguser}<a href="viewcache.php?cacheid={$picture.cache_id}&log=A#log{$picture.logid}">{/if}{$picture.picdate|date_format:$dateformat}{if !$loguser}</a>{/if}{/if}&nbsp;{if $loguser}<a href="{if $profilelink}viewprofile.php?userid={$picture.user_id}{else}viewcache.php?cacheid={$picture.cache_id}&log=A#log{$picture.logid}{/if}">{$picture.username|escape}</a>{if $picture.cachename}<br /><span title="{$picture.cachename|escape}">{$picture.cachename|escape}</span>{/if}
{/if}
</div>
{/if}
@@ -1562,7 +1562,7 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2119', 'with re
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2121', 'You have given {curr} of {max} possible recommendations.', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2122', 'You need additional {anzahl} finds, to make another recommandation.', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2123', 'A recommendation can only be made within a \"found\"-log!', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2125', 'Show log history', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2125', 'Log pictures gallery', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2126', 'Log history', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2127', 'Log entries for caches of %1', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2128', 'Hide own logs', '2010-09-07 20:19:07');
@@ -1937,6 +1937,8 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2637', 'This Ge
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2638', 'Please verify that the geocache description is complete and all properties and attributes are set properly, according to the <a %1>instructions</a>. Then click <strong><a href=\"editcache.php?cacheid=%2&publish=now#others\">here</a></strong> and \"Save\" to publish your geocache.', '2017-08-20 19:30:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2640', 'Do you really want to delete the picture \\\'{title}\\\'?', '2017-08-22 18:45:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2641', 'There is already a report in progress for this cache, see below.', '2017-08-23 13:20:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2642', 'Log pictures for your caches:', '2017-08-24 13:50:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2643', 'There are no log pictures yet for your caches.', '2017-08-24 13:50:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2644', 'User \'%1\' is not disabled. To reset one or more caches to a previous version, you need the user\'s permission.', '2017-08-23 13:20:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2645', 'You did not confirm that the user has allowed to restore his caches.', '2017-08-23 13:20:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2646', 'The user has allowed to reset the selected caches to a previous version.', '2017-08-23 13:20:00');
@@ -1560,7 +1560,7 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2121', 'DE', 'Du hast {curr} von {max} möglichen Empfehlungen abgegeben.', '2010-09-10 23:33:33');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2122', 'DE', 'Du benötigst noch {anzahl} Funde, um eine weitere Empfehlung vorzunehmen.', '2010-09-10 23:33:33');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2123', 'DE', 'Eine Empfehlung kann nur bei einem Gefunden-Logeintrag vorgenommen werden!', '2010-09-10 23:33:33');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2125', 'DE', 'Loghistorie anzeigen', '2010-09-10 23:33:33');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2125', 'DE', 'Logbildgalerie', '2010-09-10 23:33:33');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2126', 'DE', 'Loghistorie', '2010-09-10 23:33:33');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2127', 'DE', 'Logeinträge für Caches von %1', '2010-09-10 23:33:33');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2128', 'DE', 'eigene Logs ausblenden', '2010-09-10 23:33:33');
@@ -1935,6 +1935,8 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2638', 'DE', 'Prüfe bitte, ob die Cachebeschreibung vollständig ist und alle Cacheigenschaften und -attribute gemäß <a %1>Anleitung</a> eingetragen sind. Dann klicke <strong><a href=\"editcache.php?cacheid=%2&publish=now#others\">hier</a></strong> auf &bdquo;Speichern&ldquo;, um deinen Cache zu veröffentlichen.', '2017-08-20 19:30:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2640', 'DE', 'Möchtest du das Bild &bdquo;{title}&ldquo; wirklich löschen?', '2017-08-22 18:45:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2641', 'DE', 'Für diesen Cache ist bereits eine Meldung in Arbeit, siehe unten.', '2017-08-23 13:20:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2642', 'DE', 'Logbilder für deine Caches:', '2017-08-24 13:50:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2643', 'DE', 'Es gibt noch keine Logbilder für deine Caches.', '2017-08-24 13:50:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2644', 'DE', 'Der Benutzer \'%1\' ist nicht deaktiviert. Du darfst seine Caches nur zurücksetzen, wenn er sein Einverständnis dazu gegeben hat.', '2017-08-23 13:20:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2645', 'DE', 'Du hast nicht bestätigt, dass der Benutzer mit dem Zurücksetzen der Caches einverstanden ist.', '2017-08-23 13:20:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2646', 'DE', 'Der Benutzer ist damit einverstanden, dass die ausgewählten Cachen zurückgesetzt werden.', '2017-08-23 13:20:00');
@@ -1559,7 +1559,7 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2121', 'EN', 'You have given {curr} of {max} possible recommendations.', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2122', 'EN', 'You need {anzahl} more found log(s) to make another recommendation.', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2123', 'EN', 'A recommendation can only be made within a \"found\" log!', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2125', 'EN', 'Show log history', '2013-07-22 15:50:48');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2125', 'EN', 'Log pictures gallery', '2013-07-22 15:50:48');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2126', 'EN', 'Log history', '2013-07-22 15:50:48');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2127', 'EN', 'Log entries for caches of %1', '2013-07-22 15:50:48');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2128', 'EN', 'Hide own logs', '2013-07-22 15:50:48');
@@ -1560,7 +1560,7 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2121', 'FR', 'Vous avez donné {curr} de {max} recommandations possibles.', '2015-08-25 01:29:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2122', 'FR', 'Il vous manque {anzahl} trouvés pour faire une autre recommandation.', '2015-08-25 01:29:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2123', 'FR', 'Une recommandation ne peut qu\'être fait dans un log \"trouvé\"\&nbsp;!', '2015-08-25 01:29:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2125', 'FR', 'Afficher l\'historique du logs', '2015-08-25 01:29:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2125', 'FR', 'Historique du images du logs', '2015-08-25 01:29:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2126', 'FR', 'Histoire du logs', '2015-08-25 01:29:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2127', 'FR', 'Entrées du log pour les caches de %1', '2015-08-25 01:29:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2128', 'FR', 'Cacher des propres logs', '2015-08-25 01:29:00');
@@ -1559,7 +1559,7 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2121', 'IT', 'Hai usato {curr} raccomandazioni su {max} disponibili.', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2122', 'IT', 'Devi trovare ancora {anzahl} cache per fare un\' altra raccomandazione.', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2123', 'IT', 'Puoi raccomandare questa cache solo dopo che la hai loggata come trovata!', '2013-04-25 23:00:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2125', 'IT', 'Vedi log storico', '2013-07-25 15:53:16');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2125', 'IT', 'Galleria di immagini di log', '2013-07-25 15:53:16');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2126', 'IT', 'Log storico', '2013-07-25 15:53:16');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2127', 'IT', 'Iserimenti sul log per cache di %1', '2013-07-25 15:53:16');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2128', 'IT', 'Nascondi miei logs', '2013-07-25 15:53:16');

0 comments on commit 33637ef

Please sign in to comment.
You can’t perform that action at this time.