Skip to content

Commit

Permalink
allow overtaking cache reports from other admins
Browse files Browse the repository at this point in the history
  • Loading branch information
following committed Jan 30, 2013
1 parent 9ddfbd6 commit d0de099
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
6 changes: 4 additions & 2 deletions htdocs/adminreports.php
Expand Up @@ -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);
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions htdocs/doc/sql/static-data/data.sql
Expand Up @@ -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';
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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');
Expand Down
22 changes: 15 additions & 7 deletions htdocs/templates2/ocstyle/adminreports.tpl
Expand Up @@ -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>
Expand All @@ -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">
Expand All @@ -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>
Expand Down

0 comments on commit d0de099

Please sign in to comment.