Project

General

Profile

Feature #17979 » 0007122.patch

Administrator Admin, 2008-01-11 15:26

View differences:

t3lib/config_default.php (Arbeitskopie)
'AJAX' => array( // array of key-value pairs for a unified use of AJAX calls in the TYPO3 backend. Keys are the unique ajaxIDs where the value will be resolved to call a method in an object. See ajax.php and the classes/class.typo3ajax.php for more information.
'SC_alt_db_navframe::expandCollapse' => 'typo3/alt_db_navframe.php:SC_alt_db_navframe->ajaxExpandCollapse',
'SC_alt_file_navframe::expandCollapse' => 'typo3/alt_file_navframe.php:SC_alt_file_navframe->ajaxExpandCollapse',
't3lib_TCEforms_inline::createNewRecord' => 't3lib/class.t3lib_tceforms_inline.php:t3lib_TCEforms_inline->processAjaxRequest',
't3lib_TCEforms_inline::setExpandedCollapsedState' => 't3lib/class.t3lib_tceforms_inline.php:t3lib_TCEforms_inline->processAjaxRequest',
),
),
'FE' => Array( // Configuration for the TypoScript frontend (FE). Nothing here relates to the administration backend!
t3lib/class.t3lib_tceforms.php (Arbeitskopie)
'inline' => array('appearance', 'foreign_label', 'foreign_selector', 'foreign_unique', 'maxitems', 'minitems', 'size', 'autoSizeMax', 'symmetric_label'),
);
$this->inline = t3lib_div::makeInstance('t3lib_TCEforms_inline');
// Create instance of t3lib_TCEforms_inline only if this a non-IRRE-AJAX call:
if (!isset($GLOBALS['ajaxID']) || strpos($GLOBALS['ajaxID'], 't3lib_TCEforms_inline::')!==0) {
$this->inline = t3lib_div::makeInstance('t3lib_TCEforms_inline');
}
// Prepare user defined objects (if any) for hooks which extend this function:
$this->hookObjectsMainFields = array();
t3lib/jsfunc.inline.js (Arbeitskopie)
makeAjaxCall: function(method, params, lock) {
var max, url='', urlParams='', options={};
if (method && params && params.length && this.lockAjaxMethod(method, lock)) {
url = 'alt_doc_ajax.php';
urlParams += '&ajax[0]='+method;
url = 'ajax.php';
urlParams = '&ajaxID=t3lib_TCEforms_inline::'+method;
for (var i=0, max=params.length; i<max; i++) {
urlParams += '&ajax['+(i+1)+']='+params[i];
urlParams += '&ajax['+i+']='+params[i];
}
options = {
method: 'post',
t3lib/class.t3lib_tceforms_inline.php (Arbeitskopie)
/**
* General processor for AJAX requests concerning IRRE.
* (called by typo3/ajax.php)
*
* @param array $params: additional parameters (not used here)
* @param TYPO3AJAX &$ajaxObj: the TYPO3AJAX object of this request
* @return void
*/
public function processAjaxRequest($params, &$ajaxObj) {
$ajaxArguments = t3lib_div::_GP('ajax');
$ajaxIdParts = explode('::', $GLOBALS['ajaxID'], 2);
if (isset($ajaxArguments) && is_array($ajaxArguments) && count($ajaxArguments)) {
$ajaxMethod = $ajaxIdParts[1];
switch ($ajaxMethod) {
case 'createNewRecord':
$this->processAjaxRequestConstruct($ajaxArguments);
$ajaxObj->setContentFormat('jsonbody');
$ajaxObj->setContent(
call_user_func_array(array(&$this, $ajaxMethod), $ajaxArguments)
);
break;
case 'setExpandedCollapsedState':
$ajaxObj->setContentFormat('jsonbody');
call_user_func_array(array(&$this, $ajaxMethod), $ajaxArguments);
break;
}
}
}
/**
* Construct runtime environment for Inline Relational Record Editing.
* - creates an anoymous SC_alt_doc in $GLOBALS['SOBE']
* - creates a t3lib_TCEforms in $GLOBALS['SOBE']->tceforms
* - sets ourself as reference to $GLOBALS['SOBE']->tceforms->inline
* - sets $GLOBALS['SOBE']->tceforms->RTEcounter to the current situation on client-side
*
* @param array &$ajaxArguments: The arguments to be processed by the AJAX request
* @return void
*/
protected function processAjaxRequestConstruct(&$ajaxArguments) {
require_once(PATH_typo3.'template.php');
require_once(PATH_t3lib.'class.t3lib_tceforms.php');
require_once(PATH_t3lib.'class.t3lib_clipboard.php');
global $SOBE, $BE_USER;
// Create a new anonymous object:
$SOBE = new stdClass();
$SOBE->MOD_MENU = array(
'showPalettes' => '',
'showDescriptions' => '',
'disableRTE' => ''
);
// Setting virtual document name
$SOBE->MCONF['name']='xMOD_alt_doc.php';
// CLEANSE SETTINGS
$SOBE->MOD_SETTINGS = t3lib_BEfunc::getModuleData(
$SOBE->MOD_MENU,
t3lib_div::_GP('SET'),
$SOBE->MCONF['name']
);
// Create an instance of the document template object
$SOBE->doc = t3lib_div::makeInstance('template');
$SOBE->doc->backPath = $GLOBALS['BACK_PATH'];
$SOBE->doc->docType = 'xhtml_trans';
// Initialize TCEforms (rendering the forms)
$SOBE->tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
$SOBE->tceforms->inline =& $this;
$SOBE->tceforms->RTEcounter = intval(array_shift($ajaxArguments));
$SOBE->tceforms->initDefaultBEMode();
$SOBE->tceforms->palettesCollapsed = !$SOBE->MOD_SETTINGS['showPalettes'];
$SOBE->tceforms->disableRTE = $SOBE->MOD_SETTINGS['disableRTE'];
$SOBE->tceforms->enableClickMenu = TRUE;
$SOBE->tceforms->enableTabMenu = TRUE;
// Clipboard is initialized:
$SOBE->tceforms->clipObj = t3lib_div::makeInstance('t3lib_clipboard'); // Start clipboard
$SOBE->tceforms->clipObj->initializeClipboard(); // Initialize - reads the clipboard content from the user session
// Setting external variables:
if ($BE_USER->uc['edit_showFieldHelp']!='text' && $SOBE->MOD_SETTINGS['showDescriptions']) {
$SOBE->tceforms->edit_showFieldHelp = 'text';
}
}
/**
* Initialize environment for AJAX calls
*
* @param string $method: Name of the method to be called
* @param array $arguments: Arguments to be delivered to the method
* @return void
* @deprecated since TYPO3 4.2.0-alpha3
*/
function initForAJAX($method, &$arguments) {
// Set t3lib_TCEforms::$RTEcounter to the given value:
......
*
* @param string $domObjectId: The calling object in hierarchy, that requested a new record.
* @param string $foreignUid: If set, the new record should be inserted after that one.
* @return string A JSON string
* @return array An array to be used for JSON
*/
function createNewRecord($domObjectId, $foreignUid = 0) {
$this->isAjaxCall = true;
......
// Remove the current level also from the dynNestedStack of TCEforms:
$this->fObj->popFromDynNestedStack();
// return the JSON string
return t3lib_div::array2json($jsonArray);
// Return the JSON array:
return $jsonArray;
}
typo3/alt_doc_ajax.php (Arbeitskopie)
t3lib_BEfunc::lockRecords();
/**
* Deprecated AJAX handler for Inline Relational Record Editing (IRRE).
* The TYPO3AJAX interface is used now instead.
*
* @deprecated since TYPO3 4.2.0-alpha3
*/
class SC_alt_doc_ajax {
var $content; // Content accumulation
var $retUrl; // Return URL script, processed. This contains the script (if any) that we should RETURN TO from the alt_doc.php script IF we press the close button. Thus this variable is normally passed along from the calling script so we can properly return if needed.
(1-1/2)