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 #10396: Syndicated Content wobject not displaying edit controls
- fixed #10386: Template override missing in nav shortcut - fixed #10386: Template override missing in nav shortcut
- fixed #10436: Story Manager - Story Edit/Delete links are Admin Only - 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 7.7.7
- Added EMS Schedule table - Added EMS Schedule table

View file

@ -848,6 +848,7 @@ sub getEditForm {
my $self = shift; my $self = shift;
my $i18n = WebGUI::International->new($self->session, 'Asset_Thingy'); my $i18n = WebGUI::International->new($self->session, 'Asset_Thingy');
my $tabform = $self->SUPER::getEditForm(); my $tabform = $self->SUPER::getEditForm();
my $things = $self->session->db->buildHashRef('select thingId, label from Thingy_things where assetId = ?',[$self->get("assetId")]); my $things = $self->session->db->buildHashRef('select thingId, label from Thingy_things where assetId = ?',[$self->get("assetId")]);
@ -860,6 +861,7 @@ sub getEditForm {
-options=>$things, -options=>$things,
); );
} }
return $tabform; return $tabform;
} }
@ -896,6 +898,9 @@ sub getFieldValue {
elsif ($field->{fieldType} eq "dateTime"){ elsif ($field->{fieldType} eq "dateTime"){
$processedValue = $self->session->datetime->epochToHuman($value,$dateTimeFormat); $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) { elsif ($field->{fieldType} =~ m/^otherThing/x) {
my $otherThingId = $field->{fieldType}; my $otherThingId = $field->{fieldType};
$otherThingId =~ s/^otherThing_//x; $otherThingId =~ s/^otherThing_//x;
@ -910,15 +915,13 @@ sub getFieldValue {
} }
} }
else { else {
my %fieldProperties = %$field; $field->{ value } = $value;
$fieldProperties{options} = $field->{possibleValues}; $field->{ defaultValue } = $value;
$processedValue my $plugin = $self->getFormPlugin( $field );
= WebGUI::Form::DynamicField->new( $self->session, %fieldProperties, defaultValue => $value ) $processedValue = $plugin->getValueAsHtml;
->getValueAsHtml;
} }
return $processedValue; return $processedValue;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -934,7 +937,24 @@ A hashref containing the properties of this field.
=cut =cut
sub getFormElement { 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 $self = shift;
my $data = shift; my $data = shift;
my %param; 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; my @defaultValues;
if ($self->session->form->param($name)) { if ( $self->session->form->param($name) && !$data->{value} ) {
@defaultValues = $session->form->selectList($name); @defaultValues = $session->form->process( $name, $data->{fieldType} );
} }
else { else {
foreach (split(/\n/x, $data->{value})) { foreach (split(/\n/x, $data->{value})) {
@ -974,6 +994,9 @@ sub getFormElement {
} }
$param{value} = \@defaultValues; $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}; my $class = 'WebGUI::Form::'. ucfirst $data->{fieldType};
eval { WebGUI::Pluggable::load($class) }; eval { WebGUI::Pluggable::load($class) };
@ -1032,8 +1055,7 @@ sub getFormElement {
} }
my $formElement = eval { WebGUI::Pluggable::instanciate($class, "new", [$session, \%param ])}; 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)'; $properties{label} = $properties{label}.' (copy)';
} }
$dialogBody = $self->getEditFieldForm(\%properties); $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); $self->session->output->print($dialogBody->print);
return "chunked"; return "chunked";
} }
@ -2245,6 +2271,9 @@ sub www_editFieldSave {
."<input onClick=\"deleteListItem('".$self->session->url->page()."','".$newFieldId ."<input onClick=\"deleteListItem('".$self->session->url->page()."','".$newFieldId
."','".$properties{thingId}."')\" value='".$i18n->get('Delete','Icon')."' type='button'></td>\n</tr>\n</table>"; ."','".$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); $session->output->print($newFieldId.$listItemHTML);
return "chunked"; return "chunked";
} }
@ -3212,9 +3241,14 @@ sequenceNumber');
"searchFields_textForm" => $searchTextForm, "searchFields_textForm" => $searchTextForm,
"searchFields_is".$fieldType => 1, "searchFields_is".$fieldType => 1,
}); });
my $searchValue = $session->form->process("field_".$field->{fieldId});
push @constraints, $dbh->quote_identifier("field_".$field->{fieldId}) . " LIKE " my @searchValue = $session->form->process("field_".$field->{fieldId});
. $dbh->quote('%'.$searchValue.'%') if ($searchValue); my $constraint =
join ' OR ',
map { $dbh->quote_identifier("field_".$field->{fieldId}) . " LIKE " . $dbh->quote('%'.$_.'%') }
@searchValue ;
push @constraints, " ( $constraint ) " if @searchValue;
} }
if($field->{displayInSearch}){ if($field->{displayInSearch}){
my $orderByUrl = $self->session->url->append($currentUrl,"orderBy=".$field->{fieldId}); my $orderByUrl = $self->session->url->append($currentUrl,"orderBy=".$field->{fieldId});
@ -3249,7 +3283,7 @@ sequenceNumber');
$self->session->errorHandler->warn("The default Thing has no fields selected to display in the search."); $self->session->errorHandler->warn("The default Thing has no fields selected to display in the search.");
$noFields = 1; $noFields = 1;
} }
# store query in cache for thirty minutes # store query in cache for thirty minutes
WebGUI::Cache->new($self->session,"query_".$thingId)->set($query,30*60); WebGUI::Cache->new($self->session,"query_".$thingId)->set($query,30*60);