use strict;
use warnings;
+sub bump {
+ my ($r) = @_;
+ $r->authenticate('require_login' => 1);
+ $r->set_title('Move Patch To New CommitFest');
+
+ # Fetch patch.
+ my $d = $r->db->select_one(<<EOM, $r->cgi_required_id);
+SELECT id, name, commitfest_id FROM patch_view WHERE id = ?
+EOM
+ $r->error_exit('Patch not found.') if !defined $d;
+ $r->set_title("Move Patch %s To Another CommitFest", $d->{'name'});
+ $r->add_link('/action/patch_view?id=' . $d->{'id'},
+ 'Return to Patch View');
+
+ # Fetch list of commitfests.
+ my $list = $r->db->select(<<EOM, $d->{'commitfest_id'});
+SELECT id, name, commitfest_status FROM commitfest_view WHERE id != ?
+ ORDER BY name DESC
+EOM
+
+ # Display template.
+ $r->render_template('patch_bump', { 'd' => $d, 'list' => $list });
+}
+
sub delete {
my ($r) = @_;
$r->authenticate('require_login' => 1);
# Decide whether this is a new patch or an edit of an existing
# patch, and if editing reload data from database.
- my $d;
+ my ($d, $cf);
my $id = $r->cgi_id();
if (defined $id) {
$r->set_title('Edit Patch');
EOM
$r->error_exit('Patch not found.') if !defined $d;
$r->redirect('/action/patch_view?id=' . $id) if $r->cgi('cancel');
+ my $cfid = $r->cgi_id('commitfest');
+ if (defined $cfid && $cfid != $d->{'commitfest_id'}) {
+ $cf = $r->db->select_one(<<EOM, $cfid);
+SELECT id, name FROM commitfest WHERE id = ?
+EOM
+ $r->error_exit('New CommitFest not found.') if !defined $cf;
+ $d->{'commitfest_id'} = $cf->{'id'};
+ }
}
else {
$d = $r->db->select_one(<<EOM, $r->cgi_required_id('commitfest'));
my $commitfest_topic = $r->db->select(<<EOM, $d->{'commitfest_id'});
SELECT id, name FROM commitfest_topic WHERE commitfest_id = ? ORDER BY name
EOM
+ unshift @$commitfest_topic, { 'id' => '', 'name' => '(None Selected)' };
$r->control('commitfest_topic')->choice($commitfest_topic);
$r->add_control('patch_status', 'select', 'Patch Status', 'required' => 1);
$r->control('patch_status')->choice($r->db->select(<<EOM));
# Display template.
$r->render_template('patch_form', { 'id' => $id, 'd' => $d,
- 'commitfest_topic_warning' => !@$commitfest_topic });
+ 'commitfest_topic_warning' => !@$commitfest_topic,
+ 'new_commitfest' => $cf });
}
sub view {
$r->add_link('/action/patch_comment_form?patch=' . $id,
'New Comment');
$r->add_link('/action/patch_form?id=' . $id, 'Edit Patch');
+ $r->add_link('/action/patch_bump?id=' . $id,
+ 'Move To Another CommitFest');
$r->add_link('/action/patch_delete?id=' . $id, 'Delete Patch',
'Are you sure you want to delete this patch?');
$r->render_template('patch_view', { 'd' => $d, 'patch_comment_list'
+[% IF new_commitfest %]
+<p class='error'>You are moving this patch to a different CommitFest. Since
+topics are CommitFest-specific, you must select an appropriate topic for this
+patch from among those defined for the target CommitFest.
+<input name='commitfest' type='hidden' value='[% new_commitfest.id %]'></p>
+[% SET nopara = 1 %]
+[% END %]
+
[% IF commitfest_topic_warning %]
<p class='error'>Note: No topics have been defined for this CommitFest.
Before you can add patches to this CommitFest, you will need to visit the
<a href='/action/commitfest_topic_search?id=[% d.commitfest_id %]'>CommitFest
-Topics</a> page and add one or more topics.
-[% ELSE %]
+Topics</a> page and add one or more topics.</p>
+[% SET nopara = 1 %]
+[% END %]
+
+[% IF !nopara %]
<p></p>
[% END %]