G6HJY2V4CSSZF6BPIMRMRAJYRKPLTCBUFTJWZWK3BSNT235CZQ6QC
JFZNAYJXKCMXYHGCLTRH7Q6TOFGJ4BT6332GONCWVYRLNMDDG3KAC
J5UVLXOK6EDIL5I7VKWH4V2QDS4DPD7FHRK6XBWSXFRQS4JKXFZQC
FHF6IZJQPUQHY5QWQYRPZVDBRLHREWRHGNKVQDT7F3GQKKLZXJKQC
LQ5QEDVVHVGX67NJZQ46HOSY336VCLN63L3DT6QNSDV6ARVARITAC
RU7AQO7U4HCWJNQTR2KRGDLLG24WYD47MWIHREV6SIAPCPDQHAWQC
US27ZTX5HCH53SQN2KFSCV2GL2625XL5J3WCDR7D5HLPA7ZSPX5AC
N22GPKYTOLZLBGTGDATQDVZ4R5APZEAOIA7L32X4UXBH4XNI7MWAC
(my $releaseSet) = $c->model('DB::Releasesets')->find($projectName, $releaseName);
die "Release set $releaseName doesn't exist." if !defined $releaseSet;
(my $releaseSet) = $c->model('DB::Releasesets')->find($projectName, $releaseSetName);
die "Release set $releaseSetName doesn't exist." if !defined $releaseSet;
sub updateReleaseSet {
my ($c, $releaseSet) = @_;
my $releaseSetName = trim $c->request->params->{name};
die "Invalid release set name: $releaseSetName" unless $releaseSetName =~ /^[[:alpha:]]\w*$/;
$releaseSet->name($releaseSetName);
$releaseSet->description(trim $c->request->params->{description});
$releaseSet->update;
}
my ($project, $releaseSet, $primaryJob) = getReleaseSet($c, $projectName, $releaseName);
my ($project, $releaseSet, $primaryJob) = getReleaseSet($c, $projectName, $releaseSetName);
if ($subcommand ne "") {
return requireLogin($c) if !$c->user_exists;
return error($c, "Only the project owner or the administrator can perform this operation.")
unless $c->check_user_roles('admin') || $c->user->username eq $project->owner;
if ($subcommand eq "edit") {
$c->stash->{template} = 'edit-releaseset.tt';
return;
}
elsif ($subcommand eq "submit") {
$c->model('DB')->schema->txn_do(sub {
updateReleaseSet($c, $releaseSet);
});
return $c->res->redirect($c->uri_for("/releases", $projectName, $releaseSet->name));
}
else { return error($c, "Unknown subcommand."); }
}
$c->stash->{template} = 'releases.tt';
[% WRAPPER layout.tt title="Release Sets ‘$curProject.name:$releaseSet.name’" %]
[% PROCESS common.tt %]
[% USE HTML %]
<h1>Release Set <tt>[% curProject.name %]:[% releaseSet.name %]</tt></h1>
<form action="[% IF create %][% ELSE %][% c.uri_for('/releases' curProject.name releaseSet.name 'submit') %][% END %]" method="post">
<table class="layoutTable">
<tr>
<th>Identifier:</th>
<td><input type="text" class="string" name="name" [% HTML.attributes(value => releaseSet.name) %] /></td>
</tr>
<tr>
<th>Description:</th>
<td><input type="text" class="string" name="description" [% HTML.attributes(value => releaseSet.description) %] /></td>
</tr>
</table>
<p><button type="submit"><img src="/static/images/success.gif" />[%IF create %]Create[% ELSE %]Apply changes[% END %]</button></p>
</form>
[% END %]
<li><a href="[% c.uri_for('/releases' curProject.name releaseSet.name) %]"><tt>[% releaseSet.name %]</tt></a></li>
<li>
<a href="[% c.uri_for('/releases' curProject.name releaseSet.name) %]"><tt>[% releaseSet.name %]</tt></a>
(<a href="[% c.uri_for('/releases' curProject.name releaseSet.name "edit") %]">edit</a>)
</li>