added log history for own caches; updates #269

This commit is contained in:
following
2013-07-21 19:10:36 +02:00
parent 1680a5237b
commit e729d5bd33
6 changed files with 138 additions and 38 deletions

View File

@ -896,6 +896,7 @@ INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustrin
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('100', 'MNU_START_OCMENU', 'Opencaching', '2112', 'Opencaching', '2112', '0', '', '1', '1', '9', '', '0', NULL);
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('101', 'MNU_START_WIKINEWS', 'New Wiki articles', '1731', 'New Wiki articles', '1731', '0', '!http://wiki.opencaching.de/index.php/Hauptseite/Neue_Artikel', '1', '1', '4', '', '0', NULL);
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('102', 'MNU_START_NEWFEATURES', 'New features', '2115', 'New features', '2114', '0', 'articles.php?page=changelog', '1', '1', '5', '', '0', NULL);
INSERT INTO `sys_menu` (`id`, `id_string`, `title`, `title_trans_id`, `menustring`, `menustring_trans_id`, `access`, `href`, `visible`, `parent`, `position`, `color`, `sitemap`, `only_if_parent`) VALUES ('103', 'MNU_MYPROFILE_OWNERLOGS', 'Log history', '2118', 'Log history', '2118', '0', '!okapi/apps/', '0', '9', '10', '', '1', NULL);
-- Table sys_trans
SET NAMES 'utf8';
@ -2545,6 +2546,12 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2121', 'You hav
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 ('2124', 'Add log-entry for the cache <a href=\"viewcache.php?cacheid={cacheid}\">{cachename}</a>', '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 ('2126', 'Log history', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2127', 'Newest 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');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2129', 'Show own logs', '2010-09-07 20:19:07');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2130', 'Newest log entries for your geocaches', '2010-09-07 20:19:07');
-- Table sys_trans_ref
SET NAMES 'utf8';
@ -6534,6 +6541,12 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
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 ('2124', 'DE', 'Logeintrag f\&uuml;r den Cache <a href=\"viewcache.php?cacheid={cacheid}\">{cachename}</a> hinzuf\&uuml;gen', '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 ('2126', 'DE', 'Loghistorie', '2010-09-10 23:33:33');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2127', 'DE', 'Neueste Logs 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');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2129', 'DE', 'eigene Logs einblenden', '2010-09-10 23:33:33');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2130', 'DE', 'Neueste Logs für deine Caches', '2010-09-10 23:33:33');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'EN', 'Reorder IDs \r', '2010-09-02 00:15:30');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2', 'EN', 'The database could not be reconnected.', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('3', 'EN', 'Testing please do not login', '2010-08-28 11:48:07');

View File

@ -5,8 +5,23 @@
* Unicode Reminder メモ
***************************************************************************/
require('./lib2/web.inc.php');
if (@$newlogs_rest)
require_once('./lib2/web.inc.php');
$add_where = '';
$newLogsPerCountry = $opt['logic']['new_logs_per_country'];
if (isset($ownerid))
{
$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;
$newLogsPerCountry = false;
$caches_logged = array();
}
elseif (@$newlogs_rest)
{
$tpl->name = 'newlogsrest';
$tpl->menuitem = MNU_START_NEWLOGSREST;
@ -14,6 +29,7 @@
// As nearly all logs are from Germany, retrieving non-German logs is
// expensive -> longer cache lifetime.
$tpl->caching = true;
$tpl->cache_lifetime = 900;
$logcount = 250;
}
@ -22,12 +38,11 @@
$tpl->name = 'newlogs';
$tpl->menuitem = MNU_START_NEWLOGS;
$exclude_country = '*';
$tpl->caching = true;
$tpl->cache_lifetime = 300;
$logcount = 250;
}
$tpl->caching = true;
if (!$tpl->is_cached())
{
sql_temp_table_slave('loglist');
@ -39,7 +54,8 @@
INNER JOIN `user` ON `cache_logs`.`user_id`=`user`.`user_id`
WHERE `cache_status`.`allow_user_view`=1
AND `caches`.`country`<>'&1'
AND `username`<>'&2'
AND `username`<>'&2'".
$add_where."
ORDER BY `cache_logs`.`date_created` DESC
LIMIT &3",
$exclude_country,
@ -104,9 +120,9 @@
}
else if (count($newLogs) == 1)
{
$newLogs[count($newLogs)-1]['pic_uuid'] = $rPic['uuid'];
$newLogs[count($newLogs)-1]['pic_url'] = $rPic['url'];
$newLogs[count($newLogs)-1]['title'] = $rPic['title'];
$newLogs[0]['pic_uuid'] = $rPic['uuid'];
$newLogs[0]['pic_url'] = $rPic['url'];
$newLogs[0]['title'] = $rPic['title'];
$pics = $lines_per_pic+1;
}
else
@ -122,6 +138,16 @@
}
$pics--;
$rLog['first'] = false;
if (isset($caches_logged))
{
if (!isset($caches_logged[$rLog['cache_id']]))
{
$caches_logged[$rLog['cache_id']] = true;
$rLog['first'] = true;
}
}
$newLogs[] = $rLog;
}
sql_free_result($rsLogs);
@ -129,8 +155,9 @@
sql_drop_temp_table_slave('loglist');
$tpl->assign('newLogs', $newLogs);
$tpl->assign('addpiclines', max($pics-1,0));
$tpl->assign('newLogsPerCountry', $opt['logic']['new_logs_per_country']);
$tpl->assign('newLogsPerCountry', $newLogsPerCountry);
}
$tpl->display();

31
htdocs/ownerlogs.php Normal file
View File

@ -0,0 +1,31 @@
<?php
/***************************************************************************
* For license information see doc/license.txt
*
* Unicode Reminder メモ
***************************************************************************/
require 'lib2/web.inc.php';
$tpl->name = 'ownerlogs';
$tpl->menuitem = MNU_MYPROFILE_OWNERLOGS;
$login->verify();
if (isset($_REQUEST['userid']))
$ownerid = $_REQUEST['userid']+0;
else
$ownerid = $login->userid;
$ownername = sql_value("SELECT `username` FROM `user` WHERE `user_id`='&1'", false, $ownerid);
if (!sql_value("SELECT `user_id` FROM `user` WHERE `user_id`='&1'", false, $ownerid))
$tpl->error(ERROR_USER_NOT_EXISTS);
$tpl->assign('ownername', $ownername);
$tpl->assign('ownerid', $ownerid);
$show_own_logs = isset($_REQUEST['ownlogs']) && $_REQUEST['ownlogs'];
$tpl->assign('show_own_logs', $show_own_logs);
$tpl->assign('ownlogs', $ownerid == $login->userid);
require 'newlogs.php';
?>

View File

@ -128,34 +128,36 @@ function myHomeLoad()
</div>
<table class="table" style="max-width:97%">
<tr>
{if $caches|@count == 0}
<td colspan="4"><p style="margin-bottom:24px">{t}No Geocaches hidden{/t}</p></td>
{else}
{assign var="archived" value=0}
{foreach from=$caches item=cacheItem}
{if $cacheItem.status > 2}
{assign var="archived" value=$archived+1}
{/if}
{/foreach}
{if $caches|@count == 0}
<tr><td colspan="4"><p style="margin-bottom:24px">{t}No Geocaches hidden{/t}</p></td></tr>
{else}
{assign var="archived" value=0}
{foreach from=$caches item=cacheItem}
{if $cacheItem.status > 2}
{assign var="archived" value=$archived+1}
{/if}
{/foreach}
<tr>
<td colspan="4"><b><span style="line-height:2em">{t}Your geocaches hidden{/t}</b><span id="toggle_archived_option" style="display:none">{if $archived>0} (<a href="javascript:toggle_archived()" style="outline:none"><span id="hide_archived">{t}hide archived{/t}</span><span id="show_archived" style="display:none">{t}show archived{/t}</span></a>){/if}</span>:</span></td>
<td colspan="2" style="text-align:right"><span style="line-height:2em"><b>{t}Finds{/t} / {t}Last log{/t}</b></span></td>
{/if}
</tr>
{foreach from=$caches item=cacheItem}
{if $dotfill == ''}
{cycle values="listcolor1,listcolor2" assign=listcolor}
{else}
{assign var="listcolor" value=""}
{/if}
<tr {if $cacheItem.status>2}name="row_archived"{/if}>
<td>{include file="res_cacheicon_22.tpl" cachetype=$cacheItem.type} {include file="res_oconly.tpl" oconly=$cacheItem.oconly size="15x21"}</td>
<td class="{$listcolor}" style="text-align:center"><nobr>{$cacheItem.date_hidden|date_format:$opt.format.datelong}&nbsp;</nobr></td>
<td class="{$listcolor}">{include file="res_cachestatus.tpl" status=$cacheItem.status}</td>
<td class="{$listcolor}" style="{if strlen($cacheItem.name) < 45}white-space:nowrap;{/if}min-width:300px;max-width:{if $dotfill==''}400{else}300{/if}px;overflow:hidden;"><a href="viewcache.php?wp={$cacheItem.wp_oc}">{$cacheItem.name|escape}</a>{if strlen($cacheItem.name) < 45} &nbsp;&nbsp; <span style="color:#b0b0b0">{$dotfill}</span>{/if}</td>
<td class="{$listcolor}" style="text-align:right;" align="right"><nobr>&nbsp;&nbsp;{if $cacheItem.found>0}{$cacheItem.found}{/if} &nbsp;&nbsp; <a href="viewcache.php?cacheid={$cacheItem.cache_id}#logentries">{$cacheItem.lastlog|date_format:$opt.format.date}</a>&nbsp; {include file="res_logtype.tpl" type=$cacheItem.lastlog_type}</nobr></td>
</tr>
{/foreach}
{foreach from=$caches item=cacheItem}
{if $dotfill == ''}
{cycle values="listcolor1,listcolor2" assign=listcolor}
{else}
{assign var="listcolor" value=""}
{/if}
<tr {if $cacheItem.status>2}name="row_archived"{/if}>
<td>{include file="res_cacheicon_22.tpl" cachetype=$cacheItem.type} {include file="res_oconly.tpl" oconly=$cacheItem.oconly size="15x21"}</td>
<td class="{$listcolor}" style="text-align:center"><nobr>{$cacheItem.date_hidden|date_format:$opt.format.datelong}&nbsp;</nobr></td>
<td class="{$listcolor}">{include file="res_cachestatus.tpl" status=$cacheItem.status}</td>
<td class="{$listcolor}" style="{if strlen($cacheItem.name) < 45}white-space:nowrap;{/if}min-width:300px;max-width:{if $dotfill==''}400{else}300{/if}px;overflow:hidden;"><a href="viewcache.php?wp={$cacheItem.wp_oc}">{$cacheItem.name|escape}</a>{if strlen($cacheItem.name) < 45} &nbsp;&nbsp; <span style="color:#b0b0b0">{$dotfill}</span>{/if}</td>
<td class="{$listcolor}" style="text-align:right;" align="right"><nobr>&nbsp;&nbsp;{if $cacheItem.found>0}{$cacheItem.found}{/if} &nbsp;&nbsp; <a href="viewcache.php?cacheid={$cacheItem.cache_id}#logentries">{$cacheItem.lastlog|date_format:$opt.format.date}</a>&nbsp; {include file="res_logtype.tpl" type=$cacheItem.lastlog_type}</nobr></td>
</tr>
{/foreach}
<tr><td class="spacer" colspan="3"></td></tr>
<tr><td colspan="3"><a href="ownerlogs.php">{t}Show log history{/t}</a></td></tr>
{/if}
{* ... unpublished caches *}
{if $notpublished|@count}

View File

@ -6,9 +6,28 @@
{* OCSTYLE *}
<div class="content2-pagetitle">
<img src="resource2/{$opt.template.style}/images/cacheicon/traditional.gif" style="align: left; margin-right: 10px;" width="32" height="32" alt="" />
{t}Latest logs entries{/t} {if $rest}{t}Without Germany{/t}{/if}
{if $ownerlogs}
{if $ownlogs}
{t}Newest 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}
{else}
{t}Latest logs entries{/t} {if $rest}{t}Without Germany{/t}{/if}
{/if}
</div>
{if $ownerlogs && $ownlogs}
<p style="line-height:2em">
{if $show_own_logs}
<a href="ownerlogs.php?ownlogs=0">{t}Hide own logs{/t}</a>
{else}
<a href="ownerlogs.php?ownlogs=1">{t}Show own logs{/t}</a>
{/if}
</p>
{/if}
<table width="100%" class="table">
{assign var='lastCountry' value=''}
@ -25,7 +44,7 @@
{/if}
{/if}
<tr>
<td>
<td style="width:1px">
{$newLog.date_created|date_format:$opt.format.date}
</td>
<td class="listicon">
@ -54,7 +73,7 @@
<td>
{if $newLog.oc_team_comment}<img src="resource2/{$opt.template.style}/images/oclogo/oc-team-comment.png" alt="OC-Team" title="{t}OC team comment{/t}"/>{/if}
{capture name=cachename}
<a href="viewcache.php?wp={$newLog.wp_oc}">{$newLog.cachename|escape}</a>
{if $newLog.first}<b>{/if}<a href="viewcache.php?wp={$newLog.wp_oc}">{$newLog.cachename|escape}</a>{if $newLog.first}</b>{/if}
{/capture}
{capture name=username}
<a href="viewprofile.php?userid={$newLog.user_id}">{$newLog.username|escape}</a>
@ -100,5 +119,5 @@
</tr>
{assign var='lastCountry' value=$newLog.country_name}
{/foreach}
<tr><td class="spacer"></td></tr>
<tr><td class="spacer" style="height:{$addpiclines}em"></td></tr>
</table>

View File

@ -0,0 +1,8 @@
{***************************************************************************
* You can find the license in the docs directory
*
* Unicode Reminder メモ
***************************************************************************}
{* OCSTYLE *}
{include file="newlogs.tpl" ownerlogs=true}