Project

General

Profile

Bug #21924 » patch_4-6.patch

Tolleiv Nietsch, 2012-05-02 15:04

View differences:

t3lib/class.t3lib_tceforms.php
public $templateFile = ''; // Form templates, relative to typo3 directory
/**
* @var t3lib_TCEforms_suggest
*/
protected $suggest;
/**
* Constructor function, setting internal variables, loading the styles used.
......
}
// Add an empty hidden field which will send a blank value if all items are unselected.
$item .= '<input type="hidden" class="select-checkbox" name="' . htmlspecialchars($PA['itemFormElName']) . '" value="" />';
$item .= '<input type="hidden" name="' . htmlspecialchars($PA['itemFormElName']) . '" value="" />';
// Remaining checkboxes will get their set-all link:
if (count($setAll)) {
......
browserWin.focus();
}
function setFormValueFromBrowseWin(fName,value,label,title,exclusiveValues) {
var formObj = setFormValue_getFObj(fName), fObj, isMultiple = false, isList = false, isCheckboxList = false, len;
var formObj = setFormValue_getFObj(fName), fObj, isMultiple = false, isList = false, len;
if (formObj && value !== "--div--") {
// Check if the form object has a "_list" element or not
// The "_list" element exists for multiple selection select types
......
isMultiple = fObj.multiple && fObj.getAttribute("size") != "1";
isList = true;
} else {
isCheckboxList = formObj[fName].className == "select-checkbox";
fObj = formObj[fName];
}
......
setHiddenFromList(fObj,formObj[fName]);
' . $this->TBE_EDITOR_fieldChanged_func . '
}
} else if (isCheckboxList) {
var i=0;
while (formObj[fName + "[" + i + "]"]) {
if (formObj[fName + "[" + i + "]"].value == value) {
fObj = formObj[fName + "[" + i + "]"];
break;
}
i++;
};
if (fObj && !fObj.checked) {
fObj.click();
' . str_replace('_list', '', $this->TBE_EDITOR_fieldChanged_func) . '
}
} else {
// The incoming value consists of the table name, an underscore and the uid
// For a single selection field we need only the uid, so we extract it
......
if (formObj[fName] &&
(
(formObj[fName].type == "select-one") ||
(formObj[fName].className == "select-checkbox") ||
(formObj[fName + "_list"] && formObj[fName + "_list"].type.match(/select-(one|multiple)/))
)
) {
t3lib/js/jsfunc.tceforms_suggest.js
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, fieldType) {
initialize: function(objectId, table, field, uid, pid, minimumCharacters) {
var PATH_typo3 = top.TS.PATH_typo3 || window.opener.top.TS.PATH_typo3;
this.objectId = objectId;
this.suggestField = objectId + 'Suggest';
this.suggestResultList = objectId + 'SuggestChoices';
this.fieldType = fieldType;
new Ajax.Autocompleter(this.suggestField, this.suggestResultList, 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);
var ins_uid_string = (this.fieldType == 'select') ? ins_uid : (ins_table + '_' + ins_uid);
setFormValueFromBrowseWin(formEl, ins_uid_string, label);
var label = (item.firstChild.textContent ? item.firstChild.textContent : item.firstChild.innerText)
setFormValueFromBrowseWin(formEl, ins_table + '_' + ins_uid, label);
TBE_EDITOR.fieldChanged(rec_table, rec_uid, rec_field, formEl);
$(this.suggestField).value = this.defaultValue;
t3lib/tceforms/class.t3lib_tceforms_suggest.php
}
$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 . ', "' . $type . '");
'", "' . $row['uid'] . '", ' . $row['pid'] . ', ' . $minChars . ');
' . $jsObj . '.defaultValue = "' . t3lib_div::slashJS($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.findRecord')) . '";
';
(3-3/3)