Skip to content

Commit

Permalink
added comment parameter (issue #3)
Browse files Browse the repository at this point in the history
comments can be added by using the following format:

comment<delimiter><bugid> = text

where <delimiter> can be any character.

e.g.:
<mantis>
bugid = 4, 8, 13, 42
show = id, category, priority, created, updated, summary
comment.4 = This bug should be closed
comment/42 = Answer to the Ultimate Question of Life, The Universe, and Everything
comment#13 = Friday
</mantis>
  • Loading branch information
tessus committed Aug 4, 2014
1 parent 9e82288 commit cc51169
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions Mantis.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
'url' => 'https://www.mediawiki.org/wiki/Extension:Mantis',
'description' => 'Mantis Bug Tracker integration',
'license-name' => 'GPL-2.0+',
'version' => '1.1'
'version' => '1.2'
);

// Configuration variables
Expand Down Expand Up @@ -131,6 +131,7 @@ function renderMantis( $input, $args, $mwParser )
$conf['suppressinfo'] = false;
$conf['summarylength'] = NULL;
$conf['show'] = array('id','category','severity','status','updated','summary');
$conf['comment'] = NULL;

$tableOptions = array('sortable', 'standard', 'noborder');
$orderbyOptions = createArray($columnNames);
Expand Down Expand Up @@ -246,6 +247,14 @@ function renderMantis( $input, $args, $mwParser )
default:
break;
} // end main switch()
if (substr($type, 0, 7) == "comment")
{
if (is_numeric(substr($type, 8)))
{
$id = intval(substr($type, 8));
$conf['comment'][$id] = $arg;
}
}
} // end foreach()

// build the link url
Expand Down Expand Up @@ -362,6 +371,10 @@ function renderMantis( $input, $args, $mwParser )
{
$output .= "!".ucfirst($colname)."\n";
}
if (!empty($conf['comment']))
{
$output .= "!Comment\n";
}
}

$format = "|style=\"padding-left:10px; padding-right:10px; color: black; background-color: #%s; text-align:%s\" |";
Expand Down Expand Up @@ -429,8 +442,20 @@ function renderMantis( $input, $args, $mwParser )
break;
}
}
}
if (!empty($conf['comment']))
{
$output .= sprintf($format, $color, 'left');

if (array_key_exists($row[id], $conf['comment']))
{
$output .= $conf['comment'][$row[id]]."\n";
}
else
{
$output .= "\n";
}
}
}
// create table end
$output .= "|}\n";

Expand Down

0 comments on commit cc51169

Please sign in to comment.