Here's the preemptive patch before Dawn files a bug report.
It uses
the handy eval_codeselect function in Bric::App::Util to
perform
validation rather than have its own set of rules.
Once you already have a code select and then go in to edit
it, you can
then put invalid code and it still lets you save. Once you
notice the
resulting code select is empty and you go in to edit again,
the
add_msg red warning ("Invalid code select...")
shows up at that point.
Not sure if this is a bug or a feature but the attached
patch doesn't
deal with this part.
Index: lib/Bric/App/Callback/Profile/FormBuilder.pm
============================================================
=======
--- lib/Bric/App/Callback/Profile/FormBuilder.pm (revision
8043)
+++ lib/Bric/App/Callback/Profile/FormBuilder.pm (working
copy)
 -8,7
+8,7 
use Bric::App::Authz qw(:all);
use Bric::App::Event qw(log_event);
use Bric::App::Session qw(:user);
-use Bric::App::Util qw(:aref :msg :history :pkg :browser);
+use Bric::App::Util qw(:aref :msg :history :pkg :browser
:elem);
use Bric::Biz::ElementType::Parts::FieldType;
use Bric::Biz::OutputChannel;
use Bric::Biz::OutputChannel::Element;
 -538,9
+538,8 
if ($param-> eq 'codeselect') {
# XXX: change if comp/widgets/profile/
displayAttrs.mc changes..
my $code = $param->;
- my $items = eval "$code";
- unless (ref $items eq 'ARRAY' and !( $items %
2)) {
- add_msg("Invalid codeselect code
(didn't return
an array ref of even size)");
+ my $items = eval_codeselect($code);
+ unless (ref $items eq 'HASH' or ref $items
eq
'ARRAY') {
$$no_save = 1;
return;
}
---
Greg Heo
web/software systems developer
greg node79.com
416.826.7630
|