}
}
+ my $code_path = $self->app->home->rel_dir('public') . "/code";
if ( $commit ) {
warn "# commit on ", $#$filtered + 1, " items:\n$code\n";
foreach ( 0 .. $#$filtered ) {
}
if ( my $description = $self->param('code_description') ) {
my $depends = $self->param('code_depends') || die "no code_depends?";
- my $path = $self->app->home->rel_dir('public') . "/code/$depends.$description.pl";
- write_file $path, $code;
- warn "code $path ", -s $path, " bytes saved\n";
+ my $path = "$code_path/$depends.$description.pl";
+ if ( -e $path && ! $self->param('overwrite') ) {
+ warn "# code $path not saved\n";
+ } else {
+ write_file $path, $code;
+ warn "code $path ", -s $path, " bytes saved\n";
+ }
}
$code = '';
}
code_description =>
$self->param('code_description') ||
join(',', grep { defined $cols_changed->{$_} && $cols_changed->{$_} == 2 } @columns ),
+ code_path => $code_path,
);
}
% if ( $code_depends ) {
<input name=code_depends type=hidden value="<%= $code_depends %>">
<tt><%= $code_depends %>.<input name=code_description type=text value="<%= $code_description %>">.pl</tt>
+% my $path = "$code_path/$code_depends.$code_description.pl";
+% if ( -e $path ) {
+<input type=checkbox name=overwrite value=1 title="Overwrite old version of this code">
+% }
% }
<input id=close name=close type=button value="Close" style="float: right">