- fix: bug in EMS purge

- fix: bug in poll where you can't edit it to have less answers
This commit is contained in:
JT Smith 2007-08-16 21:03:53 +00:00
parent c1b95c7a62
commit 5167b279f5
5 changed files with 37 additions and 26 deletions

View file

@ -1,4 +1,6 @@
7.4.4
- fix: bug in EMS purge
- fix: bug in poll where you can't edit it to have less answers
7.4.3

View file

@ -873,10 +873,10 @@ sub getEventMetaDataFields {
my $sql = "select f.*, d.fieldData
from EventManagementSystem_metaField f
left join EventManagementSystem_metaData d on f.fieldId=d.fieldId
and d.productId=".$self->session->db->quote($productId)." $globalWhere
and d.productId=? $globalWhere
order by f.sequenceNumber";
tie my %hash, 'Tie::IxHash';
my $sth = $self->session->db->read($sql);
my $sth = $self->session->db->read($sql,[$productId]);
while( my $h = $sth->hashRef) {
foreach(keys %$h) {
$hash{$h->{fieldId}}{$_} = $h->{$_};
@ -1080,7 +1080,7 @@ sub purge {
$self->deletePrereqSet($id);
}
# delete badges
my $sth = $db->read("select fieldId from EventManagementSystem_badges where assetId=?",[$self->getId]);
my $sth = $db->read("select badgeId from EventManagementSystem_badges where assetId=?",[$self->getId]);
while (my ($id) = $sth->array) {
$self->deleteBadge($id);
}
@ -3408,24 +3408,13 @@ sub www_editEventMetaDataField {
-hoverHelp=>$i18n->get('474 description'),
-value=>$data->{required}
);
my $fieldType = WebGUI::Form::FieldType->new($self->session,
-name=>"dataType",
-label=>$i18n->get(486),
-hoverHelp=>$i18n->get('486 description'),
-value=>ucfirst $data->{dataType},
-defaultValue=>"Text",
);
my @profileForms = ();
foreach my $form ( sort @{ $fieldType->get("types") }) {
next if $form eq 'DynamicField';
my $cmd = join '::', 'WebGUI::Form', $form;
eval "use $cmd";
my $w = eval {"$cmd"->new($self->session)};
push @profileForms, $form if $w->get("profileEnabled");
}
$fieldType->set("types", \@profileForms);
$f->raw($fieldType->toHtmlWithWrapper());
$f->fieldType(
-name=>"dataType",
-label=>$i18n->get(486),
-hoverHelp=>$i18n->get('486 description'),
-value=>ucfirst $data->{dataType},
-defaultValue=>"Text",
);
$f->textarea(
-name => "possibleValues",
-label => $i18n->get(487),

View file

@ -339,11 +339,13 @@ sub prepareView {
sub processPropertiesFromFormPost {
my $self = shift;
$self->SUPER::processPropertiesFromFormPost;
my (@answer, $i, $property);
@answer = split("\n",$self->session->form->process("answers"));
for ($i=1; $i<=20; $i++) {
$property->{'a'.$i} = $answer[($i-1)];
}
my $property = {};
my $answers = $self->session->form->process("answers");
$answers =~ s{\r}{}xmsg;
my @answer = split("\n",$answers);
for (my $i=1; $i<=20; $i++) {
$property->{'a'.$i} = $answer[($i-1)] || "";
}
if (WebGUI::Image::Graph->getPluginList($self->session)) {
my $graph = WebGUI::Image::Graph->processConfigurationForm($self->session);

View file

@ -440,6 +440,23 @@ sub getValueFromPost {
}
}
#-------------------------------------------------------------------
=head2 isProfileEnabled ( session )
A class method. Returns a 1 if this control can be used by the profiling system. In general that means that the
field is safe for dynamic generation.
=cut
sub isProfileEnabled {
my $class = shift;
my $session = shift;
return $class->definition($session)->[0]{profileEnabled};
}
#-------------------------------------------------------------------
=head2 new ( session, parameters )

View file

@ -139,6 +139,7 @@ sub toHtml {
$self->session->errorHandler->error("Couldn't compile form control: ".$type.". Root cause: ".$@);
next;
}
next unless $class->isProfileEnabled($self->session);
$options{$type} = $class->getName($self->session);
}
$self->set('options',\%options);