Feature #19458 ยป 9562.patch
t3lib/class.t3lib_tceforms.php (working copy) | ||
---|---|---|
$PA['fieldConf']['config']['readOnly'] = true;
|
||
$PA['itemFormElValue'] = $this->defaultLanguageData[$table.':'.$row['uid']][$field];
|
||
}
|
||
|
||
// Create a JavaScript code line which will ask the user to save/update the form due to changing the element. This is used for eg. "type" fields and others configured with "requestUpdate"
|
||
if (
|
||
($TCA[$table]['ctrl']['type'] && !strcmp($field,$TCA[$table]['ctrl']['type'])) ||
|
||
($TCA[$table]['ctrl']['requestUpdate'] && t3lib_div::inList($TCA[$table]['ctrl']['requestUpdate'],$field))) {
|
||
if($GLOBALS['BE_USER']->jsConfirmation(1)) {
|
||
($TCA[$table]['ctrl']['requestUpdate'] && t3lib_div::inList($TCA[$table]['ctrl']['requestUpdate'],$field)) ||
|
||
($PA['fieldConf']['config']['onChange'] == 'reload')) {
|
||
if($GLOBALS['BE_USER']->jsConfirmation(1) && $this->inline->inlineCount == 0) {
|
||
$alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
|
||
} else if($this->inline->inlineCount > 0) {
|
||
$alertMsgOnChange = 'inline.reloadField("'.$field.'",this.value, "'.$this->inline->inlineNames['object'].'['.$table.']['.$row['uid'].']");';
|
||
} else {
|
||
$alertMsgOnChange = 'if (TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
|
||
}
|
t3lib/class.t3lib_tceforms_inline.php (working copy) | ||
---|---|---|
switch ($ajaxMethod) {
|
||
case 'createNewRecord':
|
||
case 'synchronizeLocalizeRecords':
|
||
case 'reloadForm':
|
||
$this->isAjaxCall = true;
|
||
// Construct runtime environment for Inline Relational Record Editing:
|
||
$this->processAjaxRequestConstruct($ajaxArguments);
|
||
... | ... | |
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Reloads the individual IRRE record if a field requiring reload has changed.
|
||
*
|
||
* @param string $objectId: The form object that we are editing
|
||
* @param string $reloadField: The field name that has been modified
|
||
* @param array $reloadValue: The field value that we are changing to
|
||
* @return array JSON output to feed through AJAX
|
||
*/
|
||
function reloadForm($objectId, $reloadField, $reloadValue) {
|
||
// the current table - for this table we should add/import records
|
||
$current = $this->inlineStructure['unstable'];
|
||
// the parent table - this table embeds the current table
|
||
$parent = $this->getStructureLevel(-1);
|
||
// get TCA 'config' of the parent table
|
||
$config = $parent['config'];
|
||
// TCE forms needs to know there is at least one inline element
|
||
$this->inlineCount++;
|
||
|
||
// Put the current level also to the dynNestedStack of TCEforms:
|
||
$this->fObj->pushToDynNestedStack('inline', $this->inlineNames['object']);
|
||
|
||
$record = $this->getRecord($this->inlineFirstPid, $current['table'], $current['uid']);
|
||
// Set language of new child record to the language of the parent record:
|
||
if ($config['localizationMode']=='select') {
|
||
$parentRecord = $this->getRecord(0, $parent['table'], $parent['uid']);
|
||
$parentLanguageField = $GLOBALS['TCA'][$parent['table']]['ctrl']['languageField'];
|
||
$childLanguageField = $GLOBALS['TCA'][$current['table']]['ctrl']['languageField'];
|
||
if ($parentRecord[$languageField]>0) {
|
||
$record[$childLanguageField] = $parentRecord[$languageField];
|
||
}
|
||
}
|
||
|
||
// now there is a foreign_selector, so there is a new record on the intermediate table, but
|
||
// this intermediate table holds a field, which is responsible for the foreign_selector, so
|
||
// we have to set this field to the uid we get - or if none, to a new uid
|
||
if ($config['foreign_selector']) {
|
||
$selConfig = $this->getPossibleRecordsSelectorConfig($config, $config['foreign_selector']);
|
||
// For a selector of type group/db, prepend the tablename (<tablename>_<uid>):
|
||
$record[$config['foreign_selector']] = $selConfig['type'] != 'groupdb' ? '' : $selConfig['table'].'_';
|
||
$record[$config['foreign_selector']] .= $foreignUid;
|
||
}
|
||
|
||
if (isset($reloadValue) && isset($record[$reloadField])) {
|
||
$record[$reloadField] = $reloadValue;
|
||
}
|
||
|
||
// render the foreign record that should passed back to browser
|
||
$item = $this->renderForeignRecord($parent['uid'], $record, $config);
|
||
if($item === false) {
|
||
$jsonArray = array(
|
||
'data' => 'Access denied',
|
||
'scriptCall' => array(
|
||
"alert('Access denied');",
|
||
)
|
||
);
|
||
return $jsonArray;
|
||
}
|
||
|
||
// Encode TCEforms AJAX response with utf-8:
|
||
$item = $GLOBALS['LANG']->csConvObj->utf8_encode($item, $GLOBALS['LANG']->charSet);
|
||
|
||
$jsonArray = array(
|
||
'data' => $item,
|
||
'scriptCall' => array(
|
||
"Element.replace('" . htmlspecialchars($objectId) . "_div',json.data);",
|
||
"inline.expandCollapseRecord('" . htmlspecialchars($objectId) . "', false);",
|
||
)
|
||
);
|
||
$this->getCommonScriptCalls($jsonArray, $config);
|
||
|
||
// fade out and fade in the new record in the browser view to catch the user's eye
|
||
$jsonArray['scriptCall'][] = "inline.fadeOutFadeIn('".$objectId."_div');";
|
||
|
||
// Remove the current level also from the dynNestedStack of TCEforms:
|
||
$this->fObj->popFromDynNestedStack();
|
||
|
||
// Return the JSON array:
|
||
return $jsonArray;
|
||
|
||
}
|
||
|
||
|
||
/*******************************************************
|
||
*
|
||
* Get data from database and handle relations
|
t3lib/jsfunc.inline.js (working copy) | ||
---|---|---|
if ($(element)) {
|
||
new Effect.Fade(element, { afterFinish: function() { Element.remove(element); } });
|
||
}
|
||
}
|
||
},
|
||
|
||
reloadField: function(field, value, formField) {
|
||
// Mark the form as busy
|
||
new Effect.Opacity(formField + '_div', { from: 1.0, to: 0.5, duration: 0.1 });
|
||
this.makeAjaxCall('reloadForm', [this.getNumberOfRTE(), formField, field, value], true);
|
||
}
|
||
}
|
||
|
||
Object.extend(Array.prototype, {
|