Bug #21924 » suggest-wizard-selectFields_v2.diff
t3lib/js/jsfunc.tceforms_suggest.js (working copy) | ||
---|---|---|
suggestResultList: '',
|
||
minimumCharacters: 2,
|
||
defaultValue: '',
|
||
fieldType: '',
|
||
/**
|
||
* Wrapper for script.aculo.us' Autocompleter functionality: Assigns a new autocompletion object to
|
||
... | ... | |
* @param integer uid The uid of the record which is currently edited
|
||
* @param integer pid The pid of the record which is currently edited
|
||
* @param integer minimumCharacters the minimum characaters that is need to trigger the initial search
|
||
* @param string fieldType The TCA type of the field (e.g. group, select, ...)
|
||
*/
|
||
initialize: function(objectId, table, field, uid, pid, minimumCharacters) {
|
||
initialize: function(objectId, table, field, uid, pid, minimumCharacters, fieldType) {
|
||
this.objectId = objectId;
|
||
this.suggestField = objectId + 'Suggest';
|
||
this.suggestResultList = objectId + 'SuggestChoices';
|
||
this.fieldType = fieldType;
|
||
new Ajax.Autocompleter(this.suggestField, this.suggestResultList, top.TS.PATH_typo3 + 'ajax.php', {
|
||
paramName: 'value',
|
||
... | ... | |
var rec_field = arr[4];
|
||
var formEl = 'data[' + rec_table + '][' + rec_uid + '][' + rec_field + ']';
|
||
var label = (item.firstChild.textContent ? item.firstChild.textContent : item.firstChild.innerText)
|
||
setFormValueFromBrowseWin(formEl, ins_table + '_' + ins_uid, label);
|
||
var label = (item.firstChild.textContent ? item.firstChild.textContent : item.firstChild.innerText);
|
||
var ins_uid_string = (this.fieldType == 'select') ? ins_uid : (ins_table + '_' + ins_uid);
|
||
setFormValueFromBrowseWin(formEl, ins_uid_string, label);
|
||
TBE_EDITOR.fieldChanged(rec_table, rec_uid, rec_field, formEl);
|
||
$(this.suggestField).value = this.defaultValue;
|
t3lib/tceforms/class.t3lib_tceforms_suggest.php (working copy) | ||
---|---|---|
}
|
||
$minChars = ($minChars > 0 ? $minChars : 2);
|
||
// fetch the TCA field type to hand it over to the JS class
|
||
$type = '';
|
||
if (isset($config['fieldConf']['config']['type'])) {
|
||
$type = $config['fieldConf']['config']['type'];
|
||
}
|
||
// replace "-" with ucwords for the JS object name
|
||
$jsObj = str_replace(' ', '', ucwords(str_replace('-', ' ', t3lib_div::strtolower($suggestId))));
|
||
$this->TCEformsObj->additionalJS_post[] = '
|
||
var ' . $jsObj . ' = new TCEForms.Suggest("' . $fieldname . '", "' . $table . '", "' . $field .
|
||
'", "' . $row['uid'] . '", ' . $row['pid'] . ', ' . $minChars . ');
|
||
'", "' . $row['uid'] . '", ' . $row['pid'] . ', ' . $minChars . ', "' . $type . '");
|
||
' . $jsObj . '.defaultValue = "' . t3lib_div::slashJS($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.findRecord')) . '";
|
||
';
|
||
... | ... | |
$TSconfig = t3lib_BEfunc::getPagesTSconfig($pageId);
|
||
$wizardConfig = $GLOBALS['TCA'][$table]['columns'][$field]['config']['wizards']['suggest'];
|
||
$queryTables = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['columns'][$field]['config']['allowed']);
|
||
$queryTables = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['columns'][$field]['config']['allowed'] . ',' . $GLOBALS['TCA'][$table]['columns'][$field]['config']['foreign_table'], TRUE);
|
||
$queryTables = array_unique($queryTables);
|
||
$resultRows = array();
|
||
// fetch the records for each query table. A query table is a table from which records are allowed to
|
t3lib/tceforms/class.t3lib_tceforms_suggest_defaultreceiver.php (working copy) | ||
---|---|---|
$GLOBALS['TYPO3_DB']->escapeStrForLike($searchString, $this->table).'%\'';
|
||
// Search in all fields given by label or label_alt
|
||
$selectFieldsList = $GLOBALS['TCA'][$this->table]['ctrl']['label'] . ',' . $GLOBALS['TCA'][$this->table]['ctrl']['label_alt'];
|
||
$selectFieldsList = $GLOBALS['TCA'][$this->table]['ctrl']['label'] . ',' . $GLOBALS['TCA'][$this->table]['ctrl']['label_alt'] . ',' . $this->config['additionalSearchFields'];
|
||
$selectFields = t3lib_div::trimExplode(',', $selectFieldsList, TRUE);
|
||
$selectFields = array_unique($selectFields);
|
||
$selectParts = array();
|
||
foreach ($selectFields as $field) {
|