[TYPO3-core] RFC #6872: Add suggest-like feature to TCEforms

Steffen Müller typo3 at t3node.com
Thu Aug 6 13:11:20 CEST 2009


Hi.

On 23.07.2009 10:09 Andreas Wolf wrote:
> 
> I created a new version of the patch. Changes to v7:
> 
>  * Custom ordering of records
>  * configurable maximum number of items on the list
>  * limiting search depth and recursive search now work
> 
> I also attached a diff from v7 to v8. Please test (and give your +1 ;)),
> so we can get it into 4.3...
> 

I found some hours today to read and test v8.
Your v7-->v8 additions are fine.

I spotted some more issues, testing on Win/
IE7,FF3.0,Opera-9.6,safari-3.2.2 and Ubuntu FF3.0

1) The key of the frontend editing sysext is misspelled:
you use fe_edit, but it should be feedit.

2) IE7 only: When I select an item from the suggestion list, the title
of this item is always "undefined" in the 'selected' box. After saving
the record, everything looks fine.

3) All browsers: If result items have long titles, the title in the
dropdown list breaks into two or more lines, smashing the layout (see
appended screenshot). Since cropping is used here with
BE_USER->uc['titleLen'], the width of the dropdown list should be raised
accordingly to avoid linebreaks. Individual setting of the title lenght
would be even more comfortable (like
TCEFORM.default.suggest.maxPathTitleLength). Reducing the title lenght
on a user basis to <19 is not an option here ;-)
Another solution would be to fix the layout to support multiline item
titles.

4) Wishlist: Take ['ctrl']['label_alt'] and ['label_alt_force'] into
account in the SELECT part of
t3lib_TCEforms_Suggest_DefaultReceiver->prepareSelectStatement()
For example when having a user table, you'd probably use firstname and
lastname for the label and also like to search for both:
$TCA['tx_myext_users']['ctrl']['label'] = 'lastname';
$TCA['tx_myext_users']['ctrl']['label_alt'] = 'firstname';
$TCA['tx_myext_users']['ctrl']['label_alt_force'] = 1;

I am sorry that I didn't had the time to write a proper patch, but this
is more or less what I mean:
$likeCondition = ' LIKE \'' . ($searchWholePhrase ? '%' : '') .
$GLOBALS['TYPO3_DB']->escapeStrForLike($searchString, $this->table).'%\'';
if ($GLOBALS['TCA'][$this->table]['ctrl']['label_alt_force'] &&
$GLOBALS['TCA'][$this->table]['ctrl']['label_alt']) {
  // Search in all fields given by label or label_alt
  $selectFields =
t3lib_div::trimExplode(',',$GLOBALS['TCA'][$this->table]['ctrl']['label_alt']);
  foreach ($selectFields as $field) {
    $this->selectClause .=  $field . $likeCondition . ' OR ';
  }
}
$this->selectClause .= $GLOBALS['TCA'][$this->table]['ctrl']['label'] .
$likeCondition;

The example is not complete, since it does not respect label_alt without
label_alt_force. Maybe ignoring label_alt_force completely would solve this.

The patch will get my +1 by reading and testing if you fix this. I'm
leaving for vacation now and hope to see this feature in trunk when I'm
back!

Once again thank you very much, the suggest feature is a very cool thing.

-- 
cheers,
Steffen

TYPO3 Blog: http://www.t3node.com/
Blubber on Twitter: http://twitter.com/t3node



More information about the TYPO3-team-core mailing list