allow overtaking cache reports from other admins

This commit is contained in:
following
2013-01-30 16:31:43 +01:00
parent 9ddfbd6721
commit d0de0995e7
3 changed files with 22 additions and 9 deletions

View File

@@ -27,7 +27,7 @@
$ownerid = isset($_REQUEST['ownerid']) ? $_REQUEST['ownerid']+0 : 0;
$adminid = sql_value("SELECT `adminid` FROM `cache_reports` WHERE `id`=&1", 0, $rid);
if (isset($_REQUEST['assign']) && $rid > 0 && $adminid == 0)
if (isset($_REQUEST['assign']) && $rid > 0) // && $adminid == 0)
{
sql("UPDATE `cache_reports` SET `status`=2, `adminid`=&2 WHERE `id`=&1", $rid, $login->userid);
$tpl->redirect('adminreports.php?id='.$rid);
@@ -115,7 +115,7 @@
`c`.`name`,
`u2`.`username` AS `ownernick`,
`u`.`username`,
`u3`.`username` AS `adminname`,
IF(LENGTH(`u3`.`username`)>10, CONCAT(LEFT(`u3`.`username`,9),'.'),`u3`.`username`) AS `adminname`,
`cr`.`lastmodified`,
`cr`.`adminid` IS NOT NULL AND `cr`.`adminid`!=&1 AS otheradmin
FROM `cache_reports` `cr`
@@ -173,6 +173,8 @@
sql_free_result($rs);
$tpl->assign('list', false);
$tpl->assign('otheradmin',$record['adminid']>0 && $record['adminid'] != $login->userid);
$tpl->assign('ownreport',$record['adminid'] == $login->userid);
}
$tpl->assign('error', $error);

View File

@@ -2227,6 +2227,7 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('1798', 'Operato
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('1799', 'Only available during specified seasons', '2012-10-29 14:28:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('1800', 'This cache can be done at certain seasons only - see the cache description for more details. For example, the cache may be placed in a corn labyrinth, which only exists from bloom to harvest season.', '2012-10-29 14:28:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('1801', 'Help', '2012-11-09 19:28:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('1802', 'Warning: This report is already assigned to another admin. Consult him first before you assume the report!', '2013-01-30 16:26:00');
-- Table sys_trans_ref
SET NAMES 'utf8';
@@ -4327,6 +4328,7 @@ INSERT INTO `sys_trans_ref` (`trans_id`, `resource_name`, `line`) VALUES ('1798'
INSERT INTO `sys_trans_ref` (`trans_id`, `resource_name`, `line`) VALUES ('1799', 'table:cache_attrib;field=html_desc', '0');
INSERT INTO `sys_trans_ref` (`trans_id`, `resource_name`, `line`) VALUES ('1800', 'table:cache_attrib;field=html_desc', '0');
INSERT INTO `sys_trans_ref` (`trans_id`, `resource_name`, `line`) VALUES ('1801', './lang/de/ocstyle/lib/menu.php', '199');
INSERT INTO `sys_trans_ref` (`trans_id`, `resource_name`, `line`) VALUES ('1802', './lang/de/ocstyle/adminreports.tpl', '83');
-- Table sys_trans_text
SET NAMES 'utf8';
@@ -5716,6 +5718,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 ('1799', 'DE', 'Nur zu bestimmten Zeiten im Jahr', '2012-10-29 14:28:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1800', 'DE', 'Dieser Cache l\ässt sich nur zu bestimmten Zeite im Jahr absolvieren. N\ähere Angaben sind in der Beschreibung des Caches zu finden. Der Cache kann beispielsweise in einem Maislabyrinth versteckt sein, das nur zwischen Bl\üte- und Erntezeit existiert.', '2012-10-29 14:28:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1801', 'DE', 'Hilfe', '2012-11-09 19:32:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1802', 'DE', 'Warnung: Diese Cachemeldung wird bereits von einem anderen Admin bearbeitet. Bitte sprich dich mit ihm ab, bevor du sie übernimmst!', '2013-01-30 16:28:00');
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

@@ -26,34 +26,37 @@
{/if}
{if $list == true}
<table class="table">
<tr><th>{t}ID{/t}</th><th>{t}Name{/t}</th><th>{t}Owner{/t}</th><th>{t}Reporter{/t}</th><th>{t}Admin{/t}</th><th>{t}Date{/t}</th></tr>
<tr><th>{t}ID{/t}</th><th>{t}Name{/t}</th><th>{t}Owner{/t}</th><th>{t}Reporter{/t}</th><th>{t}Date{/t}</th></tr>
{assign var="otheradmins" value=0}
{foreach from=$reportedcaches item=rc}
<tr>
{if $rc.otheradmin > $otheradmins}
<td colspan="6"><hr /></td></tr><tr>
<td colspan=5"><p style="line-height: 1.6em;">{t}(*) New reports{/t}</p>
</td></tr>
<tr><th>{t}ID{/t}</th><th>{t}Name{/t}</th><th>{t}Owner{/t}</th><th>{t}Reporter{/t}</th><th>{t}Admin{/t}</th><th>{t}Date{/t}</th></tr>
{assign var="otheradmins" value=$rc.otheradmin}
{/if}
<td><a href="adminreports.php?id={$rc.id}">{$rc.id}</td>
<td><a href="adminreports.php?id={$rc.id}">{$rc.new|escape}{$rc.name|escape}</a></td>
<td>{$rc.ownernick|escape}</td>
<td>{$rc.username|escape}</td>
<td>{$rc.adminname|escape}</td>
{if $otheradmins}
<td>{$rc.adminname|escape}</td>
{/if}
<td style="white-space: nowrap;">{$rc.lastmodified|date_format:$opt.format.date}</td></tr>
{foreachelse}
<tr><td colspan=5>{t}No reported caches{/t}</td></tr>
{/foreach}
</table>
{if $reportedcaches != NULL}
{if $reportedcaches != NULL and $otheradmins==0}
<p style="line-height: 1.6em;">{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></p>
<p style="line-height: 1.6em;"><b>{t}Last modified:{/t}</b>&nbsp;{$lastmodified|date_format:$opt.format.datelong}</p>
<p style="line-height: 1.6em;"><b>{t}State:{/t}</b>&nbsp;{$status}&nbsp;<b>Admin:</b>&nbsp;{if $adminnick==''}{t}not assigned{/t}{else}{$adminnick|escape}{/if}</p>
<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;"><b>{t}Comment:{/t}</b>&nbsp;{$note|escape|nl2br}</p>
@@ -64,7 +67,9 @@
</p>
</div>
<p style="line-height: 1.6em;"><input type="submit" name="assign" value="{t}Assign to me{/t}" class="formbuttons" />&nbsp;&nbsp;<input type="submit" name="contact" value="{t}Contact owner{/t}" class="formbuttons" />&nbsp;&nbsp;<input type="submit" name="done" value="{t}Mark as finished{/t}" class="formbuttons" /></p>
<p style="line-height: 1.6em;"><input type="submit" name="assign" value="{t}Assign to me{/t}" class="formbuttons" />
{if $ownreport}
&nbsp;<input type="submit" name="contact" value="{t}Contact owner{/t}" class="formbuttons" />&nbsp;&nbsp;<input type="submit" name="done" value="{t}Mark as finished{/t}" class="formbuttons" /></p>
<div class="content2-container bg-blue02">
<p class="content-title-noshade-size2">
@@ -74,6 +79,9 @@
</div>
<p style="line-height: 1.6em;"><input type="submit" name="statusActive" value="{t}Ready for search{/t}" class="formbuttons" />&nbsp;&nbsp;<input type="submit" name="statusTNA" value="{t}Temporary not available{/t}" class="formbuttons" />&nbsp;&nbsp;<input type="submit" name="statusArchived" value="{t}Archived{/t}" class="formbuttons" />&nbsp;&nbsp;<input type="submit" name="statusLockedVisible" value="{t}Locked, visible{/t}" class="formbuttons" />&nbsp;&nbsp;<input type="submit" name="statusLockedInvisible" value="{t}Locked, invisible{/t}" class="formbuttons" /></p>
{elseif $otheradmin}
<br />{t}Warning: This report is already assigned to another admin. Consult him first before you assume the report!{/t}
{/if}
{/if}
</form>