installdirs: site
requires:
CGI::Simple: 0
- CGI::Untaint: 0
+ CGI::Untaint: 1.26
+ CGI::Untaint::date: 0
+ CGI::Untaint::email: 0
Class::DBI: 0.96
Class::DBI::AbstractSearch: 0
Class::DBI::AsForm: 2.2
Class::DBI::Loader::Relationship: 0
Class::DBI::Pager: 0
Class::DBI::Plugin::RetrieveAll: 0
+ Class::DBI::Plugin::Type: 0
Class::DBI::SQLite: 0
Digest::MD5: 0
File::MMagic::XS: 0.08
}
undef $obj if $creating;
+
+ die "do_update failed with error : $fatal" if ($fatal);
$r->template("edit");
} else {
$r->template("view");
}
+
+
$r->objects( $obj ? [$obj] : []);
}
};
if ($fatal = $@) {
- warn "$fatal" if $r->debug;
+ warn "FATAL ERROR: $fatal" if $r->debug;
+# $self->dbi_rollback;
+ } else {
+# $self->dbi_commit;
}
$creating++;
}
sub do_delete {
my ( $self, $r ) = @_;
+ # FIXME: handle fatal error with exception
$_->SUPER::delete for @{ $r->objects || [] };
+# $self->dbi_commit;
$r->objects( [ $self->retrieve_all ] );
$r->{template} = "list";
$self->list($r);
[% END %]
[% ELSE %]
-[% INCLUDE addnew %]
+
+<div id="addnew">
+<form method="post" action="[% base %]/[% classmetadata.table %]/do_edit/">
+<fieldset>
+<legend>Add a new [% classmetadata.moniker %]</legend>
+ [% FOR col = classmetadata.columns %]
+ [% NEXT IF col == "id" %]
+ <label><span class="field">[% classmetadata.colnames.$col %]</span>
+ [%
+ SET elem = classmetadata.cgi.$col.clone;
+ IF request.action == 'do_edit';
+ IF elem.tag == "textarea";
+ elem = elem.push_content(request.param(col));
+ ELSE;
+ elem.attr("value", request.param(col));
+ END;
+ END;
+ elem.as_XML; %]
+ </label>
+ [% IF errors.$col %]
+ <span class="error">[% errors.$col | html %]</span>
+ [% END %]
+
+ [% END; %]
+ <input type="submit" name="create" value="create" />
+ <input type="hidden" name="__form_id" value="[% request.make_random_id %]" />
+</fieldset>
+</form>
+</div>
+
[% END %]
[% INCLUDE footer %]