From d68b845edacb16456d65aed1fb60ffc29cbcbf88 Mon Sep 17 00:00:00 2001 From: Tobias Oetiker Date: Thu, 30 Mar 2023 09:14:28 +0200 Subject: [PATCH] sync releases --- CHANGES | 17 +++++++++++++++++ lib/CallBackery.pm | 2 +- lib/CallBackery/GuiPlugin/AbstractForm.pm | 16 +++++++++++++--- .../source/class/callbackery/ui/form/Auto.js | 7 ++++++- 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index ede561c2..091de2b7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,20 @@ +0.45.0 2023-03-30 09:13:03 +0200 Tobias Oetiker + + - new widget attribute spellcheck which allows to enable + spellcheckers like languagetool in textareas or normal text widets + +0.44.3 2023-03-03 16:29:29 +0100 Tobias Oetiker + + - add timing for validators as well + +0.44.2 2023-03-03 16:18:45 +0100 Tobias Oetiker + + - syntax regression fixed + +0.44.1 2023-03-03 16:11:50 +0100 Tobias Oetiker + + - log time spent running getters + 0.44.0 2023-03-02 13:41:21 +0100 Tobias Oetiker - use the controller supplied securityHeaders method if one exists, diff --git a/lib/CallBackery.pm b/lib/CallBackery.pm index f0c9e7d0..fb118d6c 100644 --- a/lib/CallBackery.pm +++ b/lib/CallBackery.pm @@ -38,7 +38,7 @@ use CallBackery::Database; use CallBackery::User; -our $VERSION = '0.44.0'; +our $VERSION = '0.45.0'; =head2 config diff --git a/lib/CallBackery/GuiPlugin/AbstractForm.pm b/lib/CallBackery/GuiPlugin/AbstractForm.pm index 874b1e80..4977d562 100644 --- a/lib/CallBackery/GuiPlugin/AbstractForm.pm +++ b/lib/CallBackery/GuiPlugin/AbstractForm.pm @@ -5,6 +5,7 @@ use CallBackery::Exception qw(mkerror); use Mojo::Promise; use Mojo::JSON qw(encode_json); use Mojo::Util qw(dumper); +use Time::HiRes; =head1 NAME @@ -90,8 +91,14 @@ sub validateData { if (not ref $entry){ die mkerror(4095,trm("sorry, don't know the field you are talking about")); } - return undef if not $entry->{set}{required} and (not defined $formData->{$fieldName} or length($formData->{$fieldName}) == 0); - return ($entry->{validator} ? $entry->{validator}->($formData->{$fieldName},$fieldName,$formData) : undef); + return if not $entry->{set}{required} and (not defined $formData->{$fieldName} or length($formData->{$fieldName}) == 0); + if ($entry->{validator}){ + my $start = time; + my $data = $entry->{validator}->($formData->{$fieldName},$fieldName,$formData); + $self->log->debug(sprintf("validator %s: %0.2fs",$fieldName,time-$start)); + return $data; + } + return; } =head2 processData($args) @@ -162,7 +169,10 @@ sub getFieldValue { return undef unless ref $entry eq 'HASH'; if ($entry->{getter}){ if (ref $entry->{getter} eq 'CODE'){ - return $entry->{getter}->($self); + my $start = time; + my $data = $entry->{getter}->($self); + $self->log->debug(sprintf("getter %s: %0.2fs",$field,time-$start)); + return $data; } else { $self->log->warn('Plugin instance'.$self->name." field $field has a broken getter\n"); diff --git a/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/ui/form/Auto.js b/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/ui/form/Auto.js index 5bc8ddae..34ec4f8c 100644 --- a/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/ui/form/Auto.js +++ b/lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/ui/form/Auto.js @@ -102,7 +102,7 @@ qx.Class.define("callbackery.ui.form.Auto", { var cfg = s.cfg || {}; var control; - + var textWidget = false; switch(s.widget) { case 'date': @@ -121,6 +121,7 @@ qx.Class.define("callbackery.ui.form.Auto", { break; case 'text': + textWidget = true; case 'time': control = new qx.ui.form.TextField(); tm[s.key] = 'text'; @@ -130,6 +131,7 @@ qx.Class.define("callbackery.ui.form.Auto", { tm[s.key] = 'text'; break; case 'textArea': + textWidget = true; control = new qx.ui.form.TextArea(); tm[s.key] = 'text'; break; @@ -176,6 +178,9 @@ qx.Class.define("callbackery.ui.form.Auto", { throw new Error("unknown widget type " + s.widget); break; } + if (textWidget && s.spellcheck){ + control.getContentElement().setAttribute('spellcheck','true'); + } if (s.key) { form.addOwnedQxObject(control, s.key); }