Skip to content
Permalink
Browse files

log history improvements

- fixes order in log history for own caches; show log date instead of creation date
- added pager to log history for own caches
- increased page number font size
- added 'more' button to own log list to show all own logs
- nicer 'myhome' display when no data present
  • Loading branch information...
following5 committed Aug 12, 2013
1 parent baea10e commit 9c1d4a757346b7c0ee3ae1dcff5f6bd325cfbce9

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -28,7 +28,8 @@
$tpl->assign('hidden', $rUser['hidden']);
//get last logs
$tpl->assign_rs('logs', sql("SELECT `cache_logs`.`cache_id` `cacheid`, `cache_logs`.`type` `type`, `cache_logs`.`date` `date`, `caches`.`name` `name`,
sql_enable_foundrows();
$tpl->assign_rs('logs', sql("SELECT SQL_CALC_FOUND_ROWS `cache_logs`.`cache_id` `cacheid`, `cache_logs`.`type` `type`, `cache_logs`.`date` `date`, `caches`.`name` `name`,
`user`.`user_id` AS `userid`, `user`.`username`, `caches`.`wp_oc`, `ca`.`attrib_id` IS NOT NULL AS `oconly`,
`cache_rating`.`rating_date` IS NOT NULL AS `recommended`
FROM `cache_logs`
@@ -39,6 +40,8 @@
WHERE `cache_logs`.`user_id`='&1'
ORDER BY `cache_logs`.`date` DESC, `cache_logs`.`date_created` DESC
LIMIT 10", $login->userid));
$tpl->assign('morelogs', sql_value("SELECT FOUND_ROWS()", 0) > 10);
sql_foundrows_done();
//get last hidden caches
$tpl->assign_rs('caches', sql("SELECT `caches`.`cache_id`, `caches`.`name`, `caches`.`type`,
@@ -9,20 +9,38 @@
$add_where = '';
$newLogsPerCountry = $opt['logic']['new_logs_per_country'];
$startat = isset($_GET['startat']) ? $_GET['startat']+0 : 0;
$urlparams = '';
if (isset($ownerid))
{
// all logs for caches of one owner
$exclude_country = '*';
$add_where = "AND `caches`.`user_id`='" . sql_escape($ownerid) . "' ";
if (!$show_own_logs)
$add_where .= "AND `cache_logs`.`user_id`<>'" . sql_escape($login->userid) . "' ";
$tpl->caching = false;
$logcount = 200;
$logcount = 100;
$paging = true;
$newLogsPerCountry = false;
$caches_logged = array();
$orderByDate = '`cache_logs`.`date` DESC, ';
if ($show_own_logs) $urlparams = '&ownlogs=1';
}
elseif (isset($userid))
{
// all logs by one user
$exclude_country = '*';
$add_where = "AND `cache_logs`.`user_id`='" . sql_escape($userid) . "' ";
$tpl->caching = false;
$logcount = 100;
$paging = true;
$newLogsPerCountry = false;
$orderByDate = '`cache_logs`.`date` DESC, ';
}
elseif (@$newlogs_rest)
{
// latest logs for all countries but Germany
$tpl->name = 'newlogsrest';
$tpl->menuitem = MNU_START_NEWLOGSREST;
$exclude_country = 'DE';
@@ -32,22 +50,30 @@
$tpl->caching = true;
$tpl->cache_lifetime = 900;
$logcount = 250;
$paging = false; // paging would probably have a performance / DB load problem
$orderByDate = '';
}
else
{
// latest logs for all countries
$tpl->name = 'newlogs';
$tpl->menuitem = MNU_START_NEWLOGS;
$exclude_country = '*';
$tpl->caching = true;
$tpl->cache_lifetime = 300;
$logcount = 250;
$paging = false; // paging would probably have a performance / DB load problem
$orderByDate = '';
}
$tpl->assign('creation_date', $orderByDate == '');
if (!$tpl->is_cached())
{
if ($paging) sql_enable_foundrows();
sql_temp_table_slave('loglist');
sql_slave("CREATE TEMPORARY TABLE &loglist (`id` INT(11) PRIMARY KEY)
SELECT `cache_logs`.`id`
SELECT SQL_CALC_FOUND_ROWS `cache_logs`.`id`
FROM `cache_logs`
INNER JOIN `caches` ON `cache_logs`.`cache_id`=`caches`.`cache_id`
INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`
@@ -56,20 +82,28 @@
AND `caches`.`country`<>'&1'
AND `username`<>'&2'".
$add_where."
ORDER BY `cache_logs`.`date_created` DESC
LIMIT &3",
ORDER BY " . $orderByDate . "`cache_logs`.`date_created` DESC
LIMIT &3, &4",
$exclude_country,
isset($_GET['showsyslogs']) ? '' : $opt['logic']['systemuser']['user'],
$startat,
$logcount);
if ($paging)
{
$total_logs = sql_value("SELECT FOUND_ROWS()", 0);
sql_foundrows_done();
$paging = ($total_logs > $logcount);
}
if ($opt['logic']['new_logs_per_country'])
$sqlOrderBy = '`countries`.`de` ASC, ';
if ($newLogsPerCountry)
$orderByCountry = '`countries`.`de` ASC, ';
else
$sqlOrderBy = '';
$orderByCountry = '';
$rsLogs = sql_slave("SELECT IFNULL(`sys_trans_text`.`text`, `countries`.`name`) AS `country_name`,
`cache_logs`.`id`,
`cache_logs`.`date_created`,
`cache_logs`.`date_created`,
`cache_logs`.`date`,
`caches`.`name` AS `cachename`,
`caches`.`wp_oc`,
`caches`.`country` AS `country`,
@@ -91,7 +125,7 @@
LEFT JOIN `cache_logs_restored` ON `cache_logs_restored`.`id`=`cache_logs`.`id`
LEFT JOIN `cache_rating` ON `cache_rating`.`cache_id`=`caches`.`cache_id` AND `cache_rating`.`user_id`=`cache_logs`.`user_id` AND `cache_rating`.`rating_date`=`cache_logs`.`date`
WHERE IFNULL(`cache_logs_restored`.`restored_by`,0)=0
ORDER BY " . $sqlOrderBy . "`cache_logs`.`date_created` DESC",
ORDER BY " . $orderByCountry . $orderByDate . "`cache_logs`.`date_created` DESC",
$opt['template']['locale']);
$newLogs = array();
@@ -156,8 +190,14 @@
$tpl->assign('newLogs', $newLogs);
$tpl->assign('addpiclines', max($pics-1,0));
$tpl->assign('newLogsPerCountry', $newLogsPerCountry);
$tpl->assign('paging', $paging);
if ($paging)
{
$pager = new pager($_SERVER["SCRIPT_NAME"] . '?startat={offset}'. $urlparams);
$pager->make_from_offset($startat, $total_logs, $logcount);
}
}
$tpl->display();
@@ -0,0 +1,22 @@
<?php
/***************************************************************************
* For license information see doc/license.txt
*
* Unicode Reminder メモ
***************************************************************************/
require 'lib2/web.inc.php';
$tpl->name = 'ownlogs';
$tpl->menuitem = MNU_MYPROFILE_OWNLOGS;
$login->verify();
if ($login->userid == 0)
$tpl->redirect('login.php?target=ownlogs.php');
$userid = $login->userid;
$tpl->assign('ownlogs', true);
require 'newlogs.php';
?>
@@ -810,6 +810,10 @@ p.editlog { font-weight: 400; display:inline; }
padding: 2px;
}

/* Pager */
.pager { font-size:14px; }
.smallpager { }

/* Garmin downlaod */
.garmintext { font-size: 1.1em; }

@@ -62,12 +62,12 @@ function myHomeLoad()
<p class="content-title-noshade-size3">
<img src="resource2/{$opt.template.style}/images/description/22x22-logs.png" width="22" height="22" style="margin-right: 10px;" />&nbsp;
{t 1=$found}Finds: %1{/t} &nbsp;
<span class="content-title-link">[<a href="search.php?showresult=1&amp;expert=0&amp;output=HTML&amp;sort=bymylastlog&amp;finderid={$login.userid}&amp;searchbyfinder=&amp;f_inactive=0&amp;logtype=1,7&amp;calledbysearch=0">{t}Geocaches found{/t}</a>]&nbsp; [<a href="search.php?showresult=1&amp;expert=0&amp;output=HTML&amp;sort=bymylastlog&amp;finderid={$login.userid}&amp;searchbyfinder=&amp;f_inactive=0&amp;logtype=1,2,3,4,5,6,7,8,9,10,11,12,13,14&amp;calledbysearch=0">{t}Geocaches logged{/t}</a>]</span>
{if $logs|@count > 0}<span class="content-title-link">[<a href="search.php?showresult=1&amp;expert=0&amp;output=HTML&amp;sort=bymylastlog&amp;finderid={$login.userid}&amp;searchbyfinder=&amp;f_inactive=0&amp;logtype=1,7&amp;calledbysearch=0">{t}Geocaches found{/t}</a>]&nbsp; [<a href="search.php?showresult=1&amp;expert=0&amp;output=HTML&amp;sort=bymylastlog&amp;finderid={$login.userid}&amp;searchbyfinder=&amp;f_inactive=0&amp;logtype=0&amp;calledbysearch=0">{t}Geocaches logged{/t}</a>]</span>{/if}
</p>
</div>
{* Ocprop: (find|us|own)erid=([0-9]+) *}
<p style="line-height: 1.6em;"><b>{t}Your latest log entries:{/t}</b></p>
<p style="line-height: 1.6em;"><b>{t}Your latest log entries{/t}{if $morelogs} </b>(<a class="systemlink" href="ownlogs.php">{t}more{/t}</a>):{else}:</b>{/if}</p>
<table class="table">
{foreach from=$logs item=logItem}
@@ -92,12 +92,13 @@ 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 !$allpics}<span class="content-title-link">[<a href="myhome.php?allpics=1">{t}Show all{/t}</a>]</span>{/if}
{if $pictures|@count > 0 && !$allpics}<span class="content-title-link">[<a href="myhome.php?allpics=1">{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>
<br />
{else}
<p style="line-height: 1.6em;">
{if !$allpics}
@@ -123,7 +124,7 @@ function myHomeLoad()
<img src="resource2/{$opt.template.style}/images/cacheicon/22x20-traditional.png" width="22" height="20" style="margin-right: 10px;" />&nbsp;
{t 1=$hidden}Geocaches hidden: %1{/t} &nbsp;
{* Ocprop: (find|us|own)erid=([0-9]+) *}
<span class="content-title-link">[<a href="search.php?showresult=1&amp;expert=0&amp;output=HTML&amp;sort=byname&amp;ownerid={$login.userid}&amp;searchbyowner=&amp;f_inactive=0&calledbysearch=0">{t}Show details{/t}</a>]&nbsp; [<a href="search.php?showresult=1&amp;expert=0&amp;output=HTML&amp;sort=byname&amp;ownerid={$login.userid}&amp;searchbyowner=&amp;f_inactive=1&calledbysearch=0">... {t}only active caches{/t}</a>]</span>
{if $caches|@count > 0}<span class="content-title-link">[<a href="search.php?showresult=1&amp;expert=0&amp;output=HTML&amp;sort=byname&amp;ownerid={$login.userid}&amp;searchbyowner=&amp;f_inactive=0&calledbysearch=0">{t}Show details{/t}</a>{if $active < $hidden}]&nbsp; [<a href="search.php?showresult=1&amp;expert=0&amp;output=HTML&amp;sort=byname&amp;ownerid={$login.userid}&amp;searchbyowner=&amp;f_inactive=1&calledbysearch=0">... {t}only active caches{/t}</a>]{/if}</span>{/if}
</p>
</div>
@@ -8,25 +8,31 @@
<img src="resource2/{$opt.template.style}/images/cacheicon/traditional.gif" style="align: left; margin-right: 10px;" width="32" height="32" alt="" />
{if $ownerlogs}
{if $ownlogs}
{t}Newest log entries for your geocaches{/t}
{t}Log entries for your geocaches{/t}
{else}
{capture name=ownerlink}<a href="viewprofile.php?userid={$ownerid}">{$ownername|escape}</a>{/capture}
{t 1=$smarty.capture.ownerlink}Newest log entries for caches of %1{/t}
{/if}
{elseif $ownlogs}
{t}Your log entries{/t}
{else}
{t}Latest logs entries{/t} {if $rest}{t}Without Germany{/t}{/if}
{/if}
</div>

{if $ownerlogs && $ownlogs}
<p style="line-height:2em">
<p style="line-height:2em">
{if $paging}
{include file="res_pager.tpl"}
&nbsp; &nbsp;
{/if}
{if $ownerlogs && $ownlogs}
{if $show_own_logs}
<a href="ownerlogs.php?ownlogs=0">{t}Hide own logs{/t}</a>
<a class="systemlink" href="ownerlogs.php?ownlogs=0">{t}Hide own logs{/t}</a>
{else}
<a href="ownerlogs.php?ownlogs=1">{t}Show own logs{/t}</a>
<a class="systemlink" href="ownerlogs.php?ownlogs=1">{t}Show own logs{/t}</a>
{/if}
</p>
{/if}
{/if}
</p>

<table width="100%" class="table">
{assign var='lastCountry' value=''}
@@ -45,7 +51,7 @@
{/if}
<tr>
<td style="width:1px">
{$newLog.date_created|date_format:$opt.format.date}
{if $creation_date}{$newLog.date_created|date_format:$opt.format.date}{else}{$newLog.date|date_format:$opt.format.date}{/if}
</td>
<td class="listicon">
{if $newLog.type==1}
@@ -118,6 +124,17 @@
{/if}
</tr>
{assign var='lastCountry' value=$newLog.country_name}
{foreachelse}
{if $ownerlogs}
<p>{t}There are no log entries yet for your geocaches.{/t}</p>
{/if}
{/foreach}
<tr><td class="spacer" style="height:{$addpiclines}em"></td></tr>
</table>

{if $paging && $newLogs|@count > 20}
<p>
{include file="res_pager.tpl"}
</p>
<br />
{/if}
@@ -0,0 +1,8 @@
{***************************************************************************
* You can find the license in the docs directory
*
* Unicode Reminder メモ
***************************************************************************}
{* OCSTYLE *}

{include file="newlogs.tpl" ownlogs=true}
@@ -7,6 +7,7 @@
***************************************************************************}
{* OCSTYLE *}
{if $pages_list}
<span class="{if isset($smallnumbers) && $smallnumbers}small{/if}pager">
{if $pages_first_link !== null}
{if $pages_first_link}
<a href="{$pages_first_link}"><img src="resource2/{$opt.template.style}/images/navigation/16x16-browse-first.png" width="16" height="16" alt="&lt;&lt;" /></a>
@@ -34,4 +35,5 @@
<img src="resource2/{$opt.template.style}/images/navigation/16x16-browse-last-inactive.png" width="16" height="16" alt="&gt;&gt;" />
{/if}
{/if}
</span>
{/if}
@@ -43,7 +43,7 @@
<td class="header-small" colspan="2">
<table width="98.5%">
<tr>
<td rowspan="1" style="width:300px; padding:0; margin:0">{include file="res_pager.tpl"}</td>
<td rowspan="1" style="width:300px; padding:0; margin:0">{include file="res_pager.tpl" smallnumbers=true}</td>
<td style="text-align:right; padding:0; margin:0">{t}Download{/t}:&nbsp;</td>
<td><nobr>
<select class="exportlist" onChange="location.href=this.options[this.selectedIndex].value">

0 comments on commit 9c1d4a7

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