Thingy bug fixes.

This commit is contained in:
Martin Kamerbeek 2009-05-28 07:58:07 +00:00
parent beff1d2166
commit 0826f09f32
2 changed files with 58 additions and 15 deletions

View file

@ -9,6 +9,15 @@
- fixed #10396: Syndicated Content wobject not displaying edit controls
- fixed #10386: Template override missing in nav shortcut
- fixed #10436: Story Manager - Story Edit/Delete links are Admin Only
- fixed a bug in Thingy where fields with list type form elements wouldn't
show up in Thingy search results ( Martin Kamerbeek / Oqapi )
- fixed a bug in Thingy where the search form would lose part of its contents
when searching. ( Martin Kamerbeek / Oqapi )
- fixed a bug in Thingy where debug information would show up in the Thing
editor when adding/editing fields. ( Martin Kamerbeek / Oqapi )
- fixed a bug in Thingy where when searching using multi value search form
elements (eg. check lists) only one of the selected elements was taken into
account in the search query. ( Martin Kamerbeek / Oqapi )
7.7.7
- Added EMS Schedule table

View file

@ -848,6 +848,7 @@ sub getEditForm {
my $self = shift;
my $i18n = WebGUI::International->new($self->session, 'Asset_Thingy');
my $tabform = $self->SUPER::getEditForm();
my $things = $self->session->db->buildHashRef('select thingId, label from Thingy_things where assetId = ?',[$self->get("assetId")]);
@ -861,6 +862,7 @@ sub getEditForm {
);
}
return $tabform;
}
@ -896,6 +898,9 @@ sub getFieldValue {
elsif ($field->{fieldType} eq "dateTime"){
$processedValue = $self->session->datetime->epochToHuman($value,$dateTimeFormat);
}
# TODO: The otherThing field type is probably also handled by getFormPlugin, so the elsif below can probably be
# safely removed. However, this requires more testing than I can provide right now, so for now this stays the
# way it was.
elsif ($field->{fieldType} =~ m/^otherThing/x) {
my $otherThingId = $field->{fieldType};
$otherThingId =~ s/^otherThing_//x;
@ -910,15 +915,13 @@ sub getFieldValue {
}
}
else {
my %fieldProperties = %$field;
$fieldProperties{options} = $field->{possibleValues};
$processedValue
= WebGUI::Form::DynamicField->new( $self->session, %fieldProperties, defaultValue => $value )
->getValueAsHtml;
$field->{ value } = $value;
$field->{ defaultValue } = $value;
my $plugin = $self->getFormPlugin( $field );
$processedValue = $plugin->getValueAsHtml;
}
return $processedValue;
}
#-------------------------------------------------------------------
@ -934,7 +937,24 @@ A hashref containing the properties of this field.
=cut
sub getFormElement {
my $self = shift;
return $self->getFormPlugin( @_ )->toHtml;
}
#-------------------------------------------------------------------
=head2 getFormPlugin ( properties )
Returns an instanciated WebGUI::Form::* plugin.
=head3 proeprties
The properties to configure the form plugin with. The fieldType key should contain the type of the form plugin.
=cut
sub getFormPlugin {
my $self = shift;
my $data = shift;
my %param;
@ -961,10 +981,10 @@ sub getFormElement {
}
}
if (WebGUI::Utility::isIn($data->{fieldType},qw(SelectList CheckList SelectBox Attachments))) {
if ( WebGUI::Utility::isIn( $data->{fieldType}, qw(SelectList CheckList SelectBox Attachments) ) ) {
my @defaultValues;
if ($self->session->form->param($name)) {
@defaultValues = $session->form->selectList($name);
if ( $self->session->form->param($name) && !$data->{value} ) {
@defaultValues = $session->form->process( $name, $data->{fieldType} );
}
else {
foreach (split(/\n/x, $data->{value})) {
@ -974,6 +994,9 @@ sub getFormElement {
}
$param{value} = \@defaultValues;
}
elsif ( $self->session->form->param($name) && !$data->{value} ) {
$param{value} = $session->form->process( $name, $data->{fieldType} );
}
my $class = 'WebGUI::Form::'. ucfirst $data->{fieldType};
eval { WebGUI::Pluggable::load($class) };
@ -1032,8 +1055,7 @@ sub getFormElement {
}
my $formElement = eval { WebGUI::Pluggable::instanciate($class, "new", [$session, \%param ])};
return $formElement->toHtml();
return $formElement;
}
#-------------------------------------------------------------------
@ -2157,6 +2179,10 @@ sub www_editField {
$properties{label} = $properties{label}.' (copy)';
}
$dialogBody = $self->getEditFieldForm(\%properties);
# Make sure we send debug information along with the field edit screen.
$session->log->preventDebugOutput;
$self->session->output->print($dialogBody->print);
return "chunked";
}
@ -2245,6 +2271,9 @@ sub www_editFieldSave {
."<input onClick=\"deleteListItem('".$self->session->url->page()."','".$newFieldId
."','".$properties{thingId}."')\" value='".$i18n->get('Delete','Icon')."' type='button'></td>\n</tr>\n</table>";
# Make sure we send debug information along with the field.
$session->log->preventDebugOutput;
$session->output->print($newFieldId.$listItemHTML);
return "chunked";
}
@ -3212,9 +3241,14 @@ sequenceNumber');
"searchFields_textForm" => $searchTextForm,
"searchFields_is".$fieldType => 1,
});
my $searchValue = $session->form->process("field_".$field->{fieldId});
push @constraints, $dbh->quote_identifier("field_".$field->{fieldId}) . " LIKE "
. $dbh->quote('%'.$searchValue.'%') if ($searchValue);
my @searchValue = $session->form->process("field_".$field->{fieldId});
my $constraint =
join ' OR ',
map { $dbh->quote_identifier("field_".$field->{fieldId}) . " LIKE " . $dbh->quote('%'.$_.'%') }
@searchValue ;
push @constraints, " ( $constraint ) " if @searchValue;
}
if($field->{displayInSearch}){
my $orderByUrl = $self->session->url->append($currentUrl,"orderBy=".$field->{fieldId});