made arbitrary oc team comments configurable; fixed team comment flag editing

This commit is contained in:
following
2013-05-27 13:53:59 +02:00
parent 541ec807fa
commit 95341ff757
8 changed files with 47 additions and 17 deletions
+3
View File
@@ -104,6 +104,9 @@
$opt['logic']['logs']['purge_email'] = 0;
$opt['logic']['logs']['purge_userdata'] = 0;
// admin may use OC-team-comment log flag only when processing a cache report
$opt['logic']['admin']['team_comments_only_for_reports'] = false;
/* 3rd party library options
* see https://my.garmin.com/api/communicator/key-generator.jsp
*/
+6
View File
@@ -373,6 +373,12 @@
$opt['logic']['license']['terms'] = 'articles.php?page=impressum#datalicense';
// 'disclaimer' and 'terms' also in lib/settings.inc.php
/* admin functions
*/
// admin may use OC-team-comment log flag only when processing a cache report
// see also setting in lib/settings.inc.php!
$opt['logic']['admin']['team_comments_only_for_reports'] = true;
/* Database charset
* frontend and php charsets are UTF-8
* here you can set a different charset for the MySQL-Engine
+1 -1
View File
@@ -104,7 +104,7 @@
$log_time_minute = isset($_POST['logminute']) ? trim($_POST['logminute']) : (substr($log_record['date'],11) == "00:00:00" ? "" : date('i', strtotime($log_record['date'])));
$top_option = isset($_POST['ratingoption']) ? $_POST['ratingoption']+0 : 0;
$top_cache = isset($_POST['rating']) ? $_POST['rating']+0 : 0;
$oc_team_comment = isset($_POST['teamcomment']) ? ($_POST['teamcomment'] != 0) : 0;
$oc_team_comment = isset($_POST['teamcomment']) ? ($_POST['teamcomment'] != 0) : ($log_record['oc_team_comment'] == '1');
$log_pw = '';
$use_log_pw = (($log_record['logpw'] == NULL) || ($log_record['logpw'] == '')) ? false : true;
@@ -19,7 +19,7 @@
<input type="hidden" name="commit" value="1"/>
<input type="hidden" name="logid" value="{logid}"/>
<table class="table">
<tr><td class="header" colspan="2"><img src="lang/de/ocstyle/images/description/22x22-logs.png" border="0" width="32" height="32" alt="" title="" align="middle"> <b>{t}remove log entry for <a href="viewcache.php?cacheid={cacheid}">{cachename}</a>{/t}</b></td></tr>
<tr><td class="header" colspan="2"><img src="lang/de/ocstyle/images/description/22x22-logs.png" border="0" width="22" height="22" alt="" title="" align="middle"> <b>{t}remove log entry for <a href="viewcache.php?cacheid={cacheid}">{cachename}</a>{/t}</b></td></tr>
<tr><td colspan="2">{t}are you sure that this log entry shall be removed?{/t}</td></tr>
<tr><td class="spacer"></td></tr>
@@ -23,7 +23,7 @@
<input type="hidden" name="commit" value="1"/>
<input type="hidden" name="logid" value="{logid}"/>
<table class="table">
<tr><td class="header" colspan="2"><img src="lang/de/ocstyle/images/description/22x22-logs.png" border="0" width="32" height="32" alt="" title="" align="middle"> <b>{t}remove log entry for <a href="viewcache.php?cacheid={cacheid}">{cachename}</a>{/t}</b></td></tr>
<tr><td class="header" colspan="2"><img src="lang/de/ocstyle/images/description/22x22-logs.png" border="0" width="22" height="22" alt="" title="" align="middle"> <b>{t}remove log entry for <a href="viewcache.php?cacheid={cacheid}">{cachename}</a>{/t}</b></td></tr>
<tr><td class="spacer"></td></tr>
<tr><td colspan="2">{t}Are you sure to remove your log entry?{/t}</td></tr>
+28 -14
View File
@@ -32,6 +32,28 @@
}
// test if the logged in user is working on a report for a certain cache
function admin_has_open_report($cache_id)
{
global $login;
$hasreport = false;
if ($login->hasAdminPriv(ADMIN_USER))
{
$rs = sql("SELECT `id` FROM `cache_reports`
WHERE `cacheid`='&1' AND `adminid`='&2' AND `status`=2",
$cache_id, $login->userid);
if ($r = sql_fetch_array($rs))
$hasreport = $r['id'] != 0;
sql_free_result($rs);
}
return $hasreport;
}
// returns ordered array of allowed log types for a cache and the active user:
// type_id => translated type name
// first entry is default for new logs
@@ -48,18 +70,7 @@
$cache_type = $rCache['type'];
$cache_status = $rCache['status'];
$owner = $login->userid == ($rCache['user_id']);
if ($login->hasAdminPriv(ADMIN_USER))
{
$rs = sql("SELECT `id` FROM `cache_reports`
WHERE `cacheid`='&1' AND `adminid`='&2' AND `status`=2",
$cache_id, $login->userid);
if ($r = sql_fetch_array($rs))
$admin = $r['id'] != 0;
else
$admin = false;
sql_free_result($rs);
}
$admin = admin_has_open_report($cache_id);
// build result list
//
@@ -106,7 +117,7 @@
function teamcomment_allowed($cache_id, $logtype_id)
{
global $login;
global $login, $opt;
if (!$login->hasAdminPriv(ADMIN_USER))
return false;
@@ -116,7 +127,10 @@
{
$rs = sql("SELECT `user_id` FROM `caches` WHERE `cache_id`='&1'", $cache_id);
if ($r = sql_fetch_array($rs))
$allowed = $login->userid != $r['user_id'];
{
$allowed = $login->userid != $r['user_id'] &&
(!$opt['logic']['admin']['team_comments_only_for_reports'] || admin_has_open_report($cache_id));
}
else
$allowed = false;
sql_free_result($rs);
+3
View File
@@ -144,6 +144,9 @@
$opt['logic']['license']['disclaimer'] = true; // also in lib2/settings-dist.inc.php
$opt['logic']['license']['terms'] = $absolute_server_URI . 'articles.php?page=impressum#datalicense';
// admin may use OC-team-comment log flag only when processing a cache report
$opt['logic']['admin']['team_comments_only_for_reports'] = false;
// see config2/settings-dist.inc.php
$opt['template']['default']['locale'] = 'DE'; // may be overwritten by $opt['domain'][...]['locale']
+4
View File
@@ -142,6 +142,10 @@
// fill_gaps = false: continue with the last waypoint
$opt['logic']['waypoint_pool']['fill_gaps'] = false;
// admin may use OC-team-comment log flag only when processing a cache report
// see also setting in config2/settings.inc.php!
$opt['logic']['admin']['team_comments_only_for_reports'] = true;
// see config2/settings-dist.inc.php
$opt['template']['default']['locale'] = 'DE'; // may be overwritten by $opt['domain'][...]['locale']
$opt['template']['default']['country'] = 'DE'; // may be overwritten by $opt['domain'][...]['country']