Skip to content
Permalink
Browse files

added comment field to admin reports; updates #110

  • Loading branch information...
following5 committed Mar 15, 2016
1 parent f45a6a2 commit a481dd5789e75f1faa489259aec477810fce1e42
@@ -824,6 +824,12 @@ function dbv_151() // new date field for ordering logs
}
}
function dbv_152()
{
if (!sql_field_exists('cache_reports', 'comment'))
sql("ALTER TABLE `cache_reports` ADD COLUMN `comment` mediumtext NOT NULL");
}
// When adding new mutations, take care that they behave well if run multiple
// times. This improves robustness of database versioning.
//
@@ -21,15 +21,25 @@
$tpl->error(ERROR_NO_ACCESS);
$id = isset($_REQUEST['id']) ? $_REQUEST['id']+0 : 0;
$rid = isset($_REQUEST['rid']) ? $_REQUEST['rid']+0 : 0;
$cacheid = isset($_REQUEST['cacheid']) ? $_REQUEST['cacheid']+0 : 0;
$ownerid = isset($_REQUEST['ownerid']) ? $_REQUEST['ownerid']+0 : 0;
$reporterid =sql_value("SELECT `userid` FROM `cache_reports` WHERE `id`=&1", 0, $rid);
$adminid = sql_value("SELECT `adminid` FROM `cache_reports` WHERE `id`=&1", 0, $rid);
$age = sql_value("SELECT DATEDIFF(NOW(),`lastmodified`) FROM `cache_reports` WHERE `id`=&1", 0, $rid);
if (isset($_REQUEST['assign']) && $rid > 0 &&
if (isset($_REQUEST['savecomment']))
{
$comment = isset($_REQUEST['commenteditor']) ? $_REQUEST['commenteditor'] : '';
$id = $rid;
sql("
UPDATE `cache_reports`
SET `comment`='&2'
WHERE `id`='&1'",
$id,
$comment);
}
elseif (isset($_REQUEST['assign']) && $rid > 0 &&
($adminid == 0 || ($adminid != $login->userid && $age >= 14)))
{
sql("UPDATE `cache_reports` SET `status`=2, `adminid`=&2 WHERE `id`=&1", $rid, $login->userid);
@@ -123,7 +133,8 @@
IFNULL(tt.text, crs.name) AS `status`,
`cr`.`date_created`, `cr`.`lastmodified`,
`c`.`name` AS `cachename`,
`c`.`user_id` AS `ownerid`
`c`.`user_id` AS `ownerid`,
`cr`.`comment`
FROM `cache_reports` AS `cr`
LEFT JOIN `cache_report_reasons` AS `crr` ON `cr`.`reason`=`crr`.`id`
LEFT JOIN `caches` AS `c` ON `c`.`cache_id`=`cr`.`cacheid`
@@ -150,6 +161,7 @@
$tpl->assign('lastmodified', $record['lastmodified']);
$tpl->assign('cachename', $record['cachename']);
$tpl->assign('ownerid', $record['ownerid']);
$tpl->assign('admin_comment', $record['comment']);
if (isset($opt['logic']['adminreports']['cachexternal']))
$tpl->assign('cachexternal', $opt['logic']['adminreports']['cachexternal']);
else
@@ -2861,6 +2861,7 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2600', 'Select
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2601', 'The problems of the cache description as mentioned in the <a href=\"%1\" target=\"_blank\"><img src=\"resource2/ocstyle/images/log/16x16-listing-outdated.png\" /> log entries</a> do no longer exist.', '2015-06-17 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2602', 'All information (coordinates, container size, difficulty, terrain, description text, encoded hints, additional waypoints) is at least up-to-date with', '2015-06-17 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2603', 'More than 2 years ago', '2015-06-17 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2604', 'Admin<br />comment:', '2015-06-17 10:09:14');

-- Table sys_trans_ref
SET NAMES 'utf8';
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('782', 'DE', 'Du kannst diesen Bericht nicht bearbeiten, weil er bereits von einem anderen Admin bearbeitet wird.', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('783', 'DE', 'Um einen Bericht zu bearbeiten, musst du ihn dir zuordnen!', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('784', 'DE', 'Keine Meldeberichte vorhanden', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('785', 'DE', 'Report von ', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('785', 'DE', 'Meldung von ', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('786', 'DE', 'von', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('787', 'DE', 'Nicht zugeordnet', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('787', 'DE', 'nicht zugeordnet', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('788', 'DE', 'Mir zuordnen', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('789', 'DE', 'E-Mail an Besitzer', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('792', 'DE', 'Als erledigt markieren', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2601', 'DE', 'Die in den <a href=\"%1\" target=\"_blank\"><img src=\"resource2/ocstyle/images/log/16x16-listing-outdated.png\" />-Logeinträgen</a> erwähnten Probleme mit der Cachebeschreibung bestehen nicht mehr.', '2015-06-17 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2602', 'DE', 'Alle Angaben (Koordinaten, Behältergröße, Schwierigkeit, Geländewertung, Beschreibungstext, verschlüsselte Hinweise, zusätzliche Wegpunkte) sind mindestens auf dem Stand von', '2015-06-17 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2603', 'DE', 'vor mehr als 2 Jahren', '2015-06-17 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2604', 'DE', 'Admin-<br />Kommentar:', '2015-06-17 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'EN', 'Reorder IDs', '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');
@@ -10,6 +10,7 @@ CREATE TABLE `cache_reports` (
`status` tinyint(3) unsigned NOT NULL default '1',
`adminid` int(11) default NULL,
`lastmodified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`comment` mediumtext NOT NULL,
PRIMARY KEY (`id`),
KEY `status` (`status`,`adminid`),
KEY `status_2` (`adminid`,`status`),
@@ -420,6 +420,7 @@ td div.mediumspacer { height:6px; }

div.default { font-size:110%; }
td.default { font-size:12px; }
textarea.default { font-size:12px; }

/*--------------------*/
/* 3.2 - Sidebar Area */
@@ -903,6 +904,12 @@ div.floatbox { float:right; margin-left:16px; padding-left:16px;}

/* Admin functions */
.adminrestore { color: #819ac1; }
.report_comment {
background-color:#f0f0f0;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
}

/* RSS feeds */
#blog div.newsblock { margin-left:20px }
@@ -4,6 +4,51 @@
* Unicode Reminder メモ
***************************************************************************}
{* OCSTYLE *}

<script type="text/javascript">
{literal}
var oldcomment;
function editcomment(edit)
{
var comment = document.getElementById('comment');
var editcomment_btn = document.getElementById('editcomment_btn');
var commenteditor = document.getElementById('commenteditor');
var canceledit = document.getElementById('canceledit');
var savecomment = document.getElementById('savecomment');
if (edit)
{
comment.style.display = 'none';
resetbutton('editcomment_btn');
editcomment_btn.style.display = 'none';
commenteditor.style.display = '';
commenteditor.focus();
commenteditor.selectionStart = commenteditor.selectionEnd = commenteditor.value.length;
oldcomment = commenteditor.value;
canceledit.style.display = '';
savecomment.style.display = '';
}
else // cancel
{
resetbutton('canceledit');
canceledit.style.display = 'none';
resetbutton('savecomment');
savecomment.style.display = 'none';
commenteditor.value = oldcomment;
commenteditor.style.display = 'none';
comment.style.display = '';
editcomment_btn.style.display = '';
}
}
{/literal}
</script>
{strip}
<form method="POST" action="adminreports.php">
<input type="hidden" name="rid" value="{$id}" />
@@ -54,24 +99,59 @@
<p style="line-height: 2.5m;">{t}(*) New reports{/t}</p>
{/if}
{else}
<p style="line-height: 1.6em;">{t}Details for report of {/t} <a href="viewcache.php?cacheid={$cacheid}" target="_blank">{$cachename|escape}</a> {t} by {/t} <a href="viewprofile.php?userid={$userid}" target="_blank">{$usernick|escape}</a>
&nbsp; &nbsp; &nbsp;
[<a href="http://www.geocaching.com/seek/nearest.aspx?t=k&origin_lat={$cache.latitude}&amp;origin_long={$cache.longitude}&amp;dist=1&amp;submit3=Search" target="_blank">{t}Nearby search at geocaching.com{/t}</a>]
&nbsp; &nbsp; &nbsp;
{foreach from=$cachexternal key=extname item=exturl}
[<a href="{$exturl|replace:_cache_id_:$cacheid}" target="_blank">{$extname}</a>] &nbsp;
{/foreach}
{$external_maintainer_msg}
</p>
{if $created != null}
<p style="line-height: 1.6em;"><b>{t}Created at:{/t}</b>&nbsp;{$created|date_format:$opt.format.datelong}</p>
{/if}
{if $lastmodified != $created}
<p style="line-height: 1.6em;"><b>{t}Last modified{/t}{t}#colonspace#{/t}</b>&nbsp;{$lastmodified|date_format:$opt.format.datelong}</p>
{/if}
<p style="line-height: 1.6em;"><b>{t}State:{/t}</b>&nbsp;{$status}&nbsp;&nbsp;<b>Admin:</b>&nbsp;{if $adminnick==''}{t}not assigned{/t}{else}{if $otheradmin}<font color="red"><b>{/if}{$adminnick|escape}{if $otheradmin}</b></font>{/if}{/if}</p>
<p style="line-height: 1.6em;"><b>{t}Reason:{/t}</b>&nbsp;{$reason|escape|nl2br}</p>
<p style="line-height: 1.6em; margin-bottom:16px"><b>{t}Comment:{/t}</b>&nbsp;{$note|escape|nl2br}</p>
<table class="table" style="width:98%">
<tr>
<td colspan="4">
<p>{t}Details for report of {/t} <a href="viewcache.php?cacheid={$cacheid}" target="_blank">{$cachename|escape}</a> {t} by {/t} <a href="viewprofile.php?userid={$userid}" target="_blank">{$usernick|escape}</a>
&nbsp; &nbsp;
[<a href="http://www.geocaching.com/seek/nearest.aspx?t=k&origin_lat={$cache.latitude}&amp;origin_long={$cache.longitude}&amp;dist=1&amp;submit3=Search" target="_blank">{t}Nearby search at geocaching.com{/t}</a>]
&nbsp; &nbsp;
{foreach from=$cachexternal key=extname item=exturl}
[<a href="{$exturl|replace:_cache_id_:$cacheid}" target="_blank">{$extname}</a>] &nbsp;
{/foreach}
{$external_maintainer_msg}
</p>
</td>
</tr>
<tr>
<td style="width:10px"><nobr><b>{t}Created at:{/t}</b></nobr></td>
<td style="width:250px">{$created|date_format:$opt.format.datelong}</td>
<td style="width:10px"><nobr><b>{t}State:{/t}</b></nobr></td>
<td style="width:440px">{$status}{if $adminnick!=''} &nbsp;&nbsp; <b>Admin</b>{t}#colonspace#{/t}: {if $otheradmin}<font color="red"><b>{/if}{$adminnick|escape}{if $otheradmin}</b></font>{/if}{/if}</td>
</tr>
<tr>
{if $lastmodified != $created}
<td><nobr><b>{t}Last modified{/t}{t}#colonspace#{/t}:</b></nobr></td>
<td>{$lastmodified|date_format:$opt.format.datelong}</td>
{else}
<td></td><td></td>
{/if}
<td><b>{t}Reason:{/t}</b></td>
<td>{$reason|escape|nl2br}</td>
</tr>
<tr><td class="spacer"></td></tr>
<tr><td class="spacer"></td></tr>
<tr>
<td style="vertical-align:text-top"><b><p>{t}Comment:{/t}</p></td>
<td colspan="3" style="padding-top: 0.6em; padding-left:0.7em;" class="report_comment"><p>{$note|escape|nl2br}</p></td>
</tr>
<tr><td class="spacer"></td></tr>
<tr><td class="spacer"></td></tr>
<tr>
<td style="vertical-align:text-top"><b><p>{t}Admin<br />comment:{/t}</p></b></td>
<td colspan="4">
<p id="comment" style="margin-bottom:1em">{$admin_comment|escape|nl2br}</p>
<input id="editcomment_btn" type="button" name="editcomment_btn" value="{if $admin_comment}{t}Edit{/t}{else}{t}Add{/t}{/if}" class="formbutton" onclick="submitbutton('editcomment_btn'); editcomment(true);" />
<textarea id="commenteditor" name="commenteditor" cols="90" rows="7" style="margin-bottom:1em; display:none" class="default">{$admin_comment|escape}</textarea>
<br />
<input id="canceledit" type="button" name="canceledit" value="{t}Cancel{/t}" class="formbutton" onclick="submitbutton('canceledit'); editcomment(false)" style="display:none" />
&nbsp; &nbsp;
<input id="savecomment" type="submit" name="savecomment" value="{t}Save{/t}" class="formbutton" onclick="submitbutton('savecomment')" style="display:none" />
</td>
</tr>
<tr><td class="spacer"></td></tr>
<tr><td class="spacer"></td></tr>
</table>
<div class="content2-container bg-blue02">
<p class="content-title-noshade-size2">

0 comments on commit a481dd5

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