/**
  * Create a tag
  *
  * @param array $params
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj
  * @return void
  * @throws \Exception
  */
 public function createTag(array $params, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj)
 {
     $request = GeneralUtility::_POST();
     try {
         // Check if a tag is submitted
         if (!isset($request['item']) || empty($request['item'])) {
             throw new \Exception('error_no-tag');
         }
         $itemUid = $request['uid'];
         if ((int) $itemUid === 0 && (strlen($itemUid) == 16 && !GeneralUtility::isFirstPartOfStr($itemUid, 'NEW'))) {
             throw new \Exception('error_no-uid');
         }
         $table = $request['table'];
         if (empty($table)) {
             throw new \Exception('error_no-table');
         }
         // Get tag uid
         $newTagId = $this->getTagUid($request);
         $ajaxObj->setContentFormat('javascript');
         $ajaxObj->setContent('');
         $response = array($newTagId, $request['item'], self::TAG, $table, 'tags', 'data[' . htmlspecialchars($table) . '][' . $itemUid . '][tags]', $itemUid);
         $ajaxObj->setJavascriptCallbackWrap(implode('-', $response));
     } catch (\Exception $e) {
         $errorMsg = $GLOBALS['LANG']->sL(self::LLPATH . $e->getMessage());
         $ajaxObj->setError($errorMsg);
     }
 }
Example #2
0
 /**
  * Sets the TYPO3 Backend context to a certain workspace,
  * called by the Backend toolbar menu
  *
  * @param array $parameters
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxRequestHandler
  * @return void
  */
 public function setWorkspace($parameters, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxRequestHandler)
 {
     $workspaceId = (int) GeneralUtility::_GP('workspaceId');
     $pageId = (int) GeneralUtility::_GP('pageId');
     $finalPageUid = 0;
     $originalPageId = $pageId;
     $this->getBackendUser()->setWorkspace($workspaceId);
     while ($pageId) {
         $page = BackendUtility::getRecordWSOL('pages', $pageId, '*', ' AND pages.t3ver_wsid IN (0, ' . $workspaceId . ')');
         if ($page) {
             if ($this->getBackendUser()->doesUserHaveAccess($page, 1)) {
                 break;
             }
         } else {
             $page = BackendUtility::getRecord('pages', $pageId);
         }
         $pageId = $page['pid'];
     }
     if (isset($page['uid'])) {
         $finalPageUid = (int) $page['uid'];
     }
     $response = array('title' => \TYPO3\CMS\Workspaces\Service\WorkspaceService::getWorkspaceTitle($workspaceId), 'workspaceId' => $workspaceId, 'pageId' => $finalPageUid && $originalPageId == $finalPageUid ? NULL : $finalPageUid);
     $ajaxRequestHandler->setContent($response);
     $ajaxRequestHandler->setContentFormat('json');
 }
 /**
  * Processes all AJAX calls and returns a JSON for the data
  *
  * @param array $parameters
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxRequestHandler
  */
 public function processAjaxRequest($parameters, AjaxRequestHandler $ajaxRequestHandler)
 {
     // do the regular / main logic, depending on the action parameter
     $action = GeneralUtility::_GP('action');
     $key = GeneralUtility::_GP('key');
     $value = GeneralUtility::_GP('value');
     $content = $this->process($action, $key, $value);
     $ajaxRequestHandler->setContentFormat('json');
     $ajaxRequestHandler->setContent($content);
 }
Example #4
0
 /**
  * General processor for AJAX requests.
  * (called by typo3/ajax.php)
  *
  * @param array $params Additional parameters (not used here)
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj The AjaxRequestHandler object of this request
  * @return void
  * @author Oliver Hader <*****@*****.**>
  */
 public function processAjaxRequest($params, \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj)
 {
     $this->ajaxObj = $ajaxObj;
     $ajaxIdParts = explode('::', $ajaxObj->getAjaxID(), 2);
     $ajaxMethod = $ajaxIdParts[1];
     $response = array();
     // Process the AJAX requests:
     if ($ajaxMethod == 'loadTemplates') {
         $ajaxObj->setContent($this->loadTemplates((int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('pageId')));
         $ajaxObj->setContentFormat('jsonbody');
     }
 }
 /**
  * @param array $params
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj
  */
 public function ajaxLoadTree($params, &$ajaxObj)
 {
     $node_id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('node');
     if ($node_id == 'root') {
         $node_repository = tx_caretaker_NodeRepository::getInstance();
         $node = $node_repository->getRootNode(true);
         $result = $this->nodeToArray($node, 2);
     } else {
         $node_repository = tx_caretaker_NodeRepository::getInstance();
         $node = $node_repository->id2node($node_id, 1);
         $result = $this->nodeToArray($node);
     }
     $ajaxObj->setContent($result['children']);
     $ajaxObj->setContentFormat('jsonbody');
 }
 /**
  * General processor for AJAX requests.
  * (called by typo3/ajax.php)
  *
  * @param array $params Additional parameters (not used here)
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj The AjaxRequestHandler object of this request
  * @return void
  * @author Oliver Hader <*****@*****.**>
  */
 public function processAjaxRequest($params, \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj)
 {
     $this->ajaxObj = $ajaxObj;
     // Load the TSref XML information:
     $this->loadFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('t3editor') . 'res/tsref/tsref.xml');
     $ajaxIdParts = explode('::', $ajaxObj->getAjaxID(), 2);
     $ajaxMethod = $ajaxIdParts[1];
     $response = array();
     // Process the AJAX requests:
     if ($ajaxMethod == 'getTypes') {
         $ajaxObj->setContent($this->getTypes());
         $ajaxObj->setContentFormat('jsonbody');
     } elseif ($ajaxMethod == 'getDescription') {
         $ajaxObj->addContent('', $this->getDescription(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('typeId'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('parameterName')));
         $ajaxObj->setContentFormat('plain');
     }
 }
Example #7
0
 /**
  * Dispatches the incoming calls to methods about the ExtDirect API.
  *
  * @param aray $ajaxParams Ajax parameters
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj typo3ajax instance
  * @return void
  */
 public function route($ajaxParams, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj)
 {
     $GLOBALS['error'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\ExtDirect\\ExtDirectDebug');
     $isForm = FALSE;
     $isUpload = FALSE;
     $rawPostData = file_get_contents('php://input');
     $postParameters = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST();
     $namespace = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('namespace');
     $response = array();
     $request = NULL;
     $isValidRequest = TRUE;
     if (!empty($postParameters['extAction'])) {
         $isForm = TRUE;
         $isUpload = $postParameters['extUpload'] === 'true';
         $request = new \stdClass();
         $request->action = $postParameters['extAction'];
         $request->method = $postParameters['extMethod'];
         $request->tid = $postParameters['extTID'];
         unset($_POST['securityToken']);
         $request->data = array($_POST + $_FILES);
         $request->data[] = $postParameters['securityToken'];
     } elseif (!empty($rawPostData)) {
         $request = json_decode($rawPostData);
     } else {
         $response[] = array('type' => 'exception', 'message' => 'Something went wrong with an ExtDirect call!', 'code' => 'router');
         $isValidRequest = FALSE;
     }
     if (!is_array($request)) {
         $request = array($request);
     }
     if ($isValidRequest) {
         $validToken = FALSE;
         $firstCall = TRUE;
         foreach ($request as $index => $singleRequest) {
             $response[$index] = array('tid' => $singleRequest->tid, 'action' => $singleRequest->action, 'method' => $singleRequest->method);
             $token = array_pop($singleRequest->data);
             if ($firstCall) {
                 $firstCall = FALSE;
                 $formprotection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
                 $validToken = $formprotection->validateToken($token, 'extDirect');
             }
             try {
                 if (!$validToken) {
                     throw new \TYPO3\CMS\Core\FormProtection\Exception('ExtDirect: Invalid Security Token!');
                 }
                 $response[$index]['type'] = 'rpc';
                 $response[$index]['result'] = $this->processRpc($singleRequest, $namespace);
                 $response[$index]['debug'] = $GLOBALS['error']->toString();
             } catch (\Exception $exception) {
                 $response[$index]['type'] = 'exception';
                 $response[$index]['message'] = $exception->getMessage();
                 $response[$index]['code'] = 'router';
             }
         }
     }
     if ($isForm && $isUpload) {
         $ajaxObj->setContentFormat('plain');
         $response = json_encode($response);
         $response = preg_replace('/&quot;/', '\\&quot;', $response);
         $response = array('<html><body><textarea>' . $response . '</textarea></body></html>');
     } else {
         $ajaxObj->setContentFormat('jsonbody');
     }
     $ajaxObj->setContent($response);
 }
 /**
  * Ajax callback that reads the smd file and modiefies the target URL to include
  * the module token.
  *
  * @param array $parameters (unused)
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxRequestHandler
  * @return void
  */
 public function getWiringEditorSmd(array $parameters, AjaxRequestHandler $ajaxRequestHandler)
 {
     $smdJsonString = file_get_contents(ExtensionManagementUtility::extPath('extension_builder') . 'Resources/Public/jsDomainModeling/phpBackend/WiringEditor.smd');
     $smdJson = json_decode($smdJsonString);
     $parameters = array('tx_extensionbuilder_tools_extensionbuilderextensionbuilder' => array('controller' => 'BuilderModule', 'action' => 'dispatchRpc'));
     $smdJson->target = BackendUtility::getModuleUrl('tools_ExtensionBuilderExtensionbuilder', $parameters);
     $smdJsonString = json_encode($smdJson);
     $ajaxRequestHandler->setContent(array($smdJsonString));
 }
Example #9
0
 /**
  * Gets plugins that are defined at $TYPO3_CONF_VARS['EXTCONF']['t3editor']['plugins']
  * (called by typo3/ajax.php)
  *
  * @param array $params additional parameters (not used here)
  * @param TYPO3AJAX	&$ajaxObj: the TYPO3AJAX object of this request
  * @return void
  * @author Oliver Hader <*****@*****.**>
  */
 public function getPlugins($params, \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj)
 {
     $result = array();
     $plugins =& $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3editor']['plugins'];
     if (is_array($plugins)) {
         $result = array_values($plugins);
     }
     $ajaxObj->setContent($result);
     $ajaxObj->setContentFormat('jsonbody');
 }
Example #10
0
 /**
  * ModuleMenu Store loading data
  *
  * @param array $params
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj
  * @return array
  */
 public function getModuleData($params, $ajaxObj)
 {
     $data = array('success' => true, 'root' => array());
     $rawModuleData = $this->getRawModuleData();
     $index = 0;
     $dummyLink = BackendUtility::getModuleUrl('dummy');
     foreach ($rawModuleData as $moduleKey => $moduleData) {
         $key = substr($moduleKey, 8);
         $num = count($data['root']);
         if ($moduleData['link'] != $dummyLink || $moduleData['link'] == $dummyLink && is_array($moduleData['subitems'])) {
             $data['root'][$num]['key'] = $key;
             $data['root'][$num]['menuState'] = $GLOBALS['BE_USER']->uc['moduleData']['menuState'][$moduleKey];
             $data['root'][$num]['label'] = $moduleData['title'];
             $data['root'][$num]['subitems'] = is_array($moduleData['subitems']) ? count($moduleData['subitems']) : 0;
             if ($moduleData['link'] && $this->linkModules) {
                 $data['root'][$num]['link'] = 'top.goToModule(' . GeneralUtility::quoteJSvalue($moduleData['name']) . ')';
             }
             // Traverse submodules
             if (is_array($moduleData['subitems'])) {
                 foreach ($moduleData['subitems'] as $subKey => $subData) {
                     $data['root'][$num]['sub'][] = array('name' => $subData['name'], 'description' => $subData['description'], 'label' => $subData['title'], 'icon' => $subData['icon']['filename'], 'navframe' => $subData['parentNavigationFrameScript'], 'link' => $subData['link'], 'originalLink' => $subData['originalLink'], 'index' => $index++, 'navigationFrameScript' => $subData['navigationFrameScript'], 'navigationFrameScriptParam' => $subData['navigationFrameScriptParam'], 'navigationComponentId' => $subData['navigationComponentId']);
                 }
             }
         }
     }
     if ($ajaxObj) {
         $ajaxObj->setContent($data);
         $ajaxObj->setContentFormat('jsonbody');
     } else {
         return $data;
     }
 }
Example #11
0
 /**
  * General processor for AJAX requests concerning IRRE.
  *
  * @param array $_ Additional parameters (not used here)
  * @param AjaxRequestHandler $ajaxObj The AjaxRequestHandler object of this request
  * @throws \RuntimeException
  * @return void
  */
 public function processInlineAjaxRequest($_, AjaxRequestHandler $ajaxObj)
 {
     $ajaxArguments = GeneralUtility::_GP('ajax');
     $ajaxIdParts = explode('::', $GLOBALS['ajaxID'], 2);
     if (isset($ajaxArguments) && is_array($ajaxArguments) && count($ajaxArguments)) {
         $ajaxMethod = $ajaxIdParts[1];
         $ajaxObj->setContentFormat('jsonbody');
         // Construct runtime environment for Inline Relational Record Editing
         $this->setUpRuntimeEnvironmentForAjaxRequests();
         // @todo: ajaxArguments[2] is "returnUrl" in the first 3 calls - still needed?
         switch ($ajaxMethod) {
             case 'synchronizeLocalizeRecords':
                 $domObjectId = $ajaxArguments[0];
                 $type = $ajaxArguments[1];
                 // Parse the DOM identifier (string), add the levels to the structure stack (array), load the TCA config:
                 $this->inlineStackProcessor->initializeByParsingDomObjectIdString($domObjectId);
                 $this->inlineStackProcessor->injectAjaxConfiguration($ajaxArguments['context']);
                 $inlineFirstPid = FormEngineUtility::getInlineFirstPidFromDomObjectId($domObjectId);
                 $ajaxObj->setContent($this->renderInlineSynchronizeLocalizeRecords($type, $inlineFirstPid));
                 break;
             case 'createNewRecord':
                 $domObjectId = $ajaxArguments[0];
                 $createAfterUid = 0;
                 if (isset($ajaxArguments[1])) {
                     $createAfterUid = $ajaxArguments[1];
                 }
                 // Parse the DOM identifier (string), add the levels to the structure stack (array), load the TCA config:
                 $this->inlineStackProcessor->initializeByParsingDomObjectIdString($domObjectId);
                 $this->inlineStackProcessor->injectAjaxConfiguration($ajaxArguments['context']);
                 $ajaxObj->setContent($this->renderInlineNewChildRecord($domObjectId, $createAfterUid));
                 break;
             case 'getRecordDetails':
                 $domObjectId = $ajaxArguments[0];
                 // Parse the DOM identifier (string), add the levels to the structure stack (array), load the TCA config:
                 $this->inlineStackProcessor->initializeByParsingDomObjectIdString($domObjectId);
                 $this->inlineStackProcessor->injectAjaxConfiguration($ajaxArguments['context']);
                 $ajaxObj->setContent($this->renderInlineChildRecord($domObjectId));
                 break;
             case 'setExpandedCollapsedState':
                 $domObjectId = $ajaxArguments[0];
                 // Parse the DOM identifier (string), add the levels to the structure stack (array), don't load TCA config
                 $this->inlineStackProcessor->initializeByParsingDomObjectIdString($domObjectId, FALSE);
                 $expand = $ajaxArguments[1];
                 $collapse = $ajaxArguments[2];
                 $this->setInlineExpandedCollapsedState($expand, $collapse);
                 break;
             default:
                 throw new \RuntimeException('Not a valid ajax identifier', 1428227862);
         }
     }
 }
 /**
  * Create a target
  *
  * @param array $params
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj
  * @return void
  * @throws Exception
  */
 public function createTarget(array $params, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj)
 {
     $request = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST();
     try {
         // Check if a tag is submitted
         if (!isset($request['item']) || empty($request['item'])) {
             throw new Exception('error_no-target');
         }
         $newsUid = $request['newsid'];
         if ((int) $newsUid === 0 && (strlen($newsUid) == 16 && !\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($newsUid, 'NEW'))) {
             throw new Exception('error_no-newsid');
         }
         // Get tag uid
         $newTargetId = $this->getTargetUid($request);
         $ajaxObj->setContentFormat('javascript');
         $ajaxObj->setContent('');
         $response = array($newTargetId, $request['item'], self::TARGET, self::NEWS, 'tags', 'data[tx_mooxnews_domain_model_news][' . $newsUid . '][targets]', $newsUid);
         $ajaxObj->setJavascriptCallbackWrap(implode('-', $response));
     } catch (Exception $e) {
         $errorMsg = $GLOBALS['LANG']->sL(self::LLPATHTARGET . $e->getMessage());
         $ajaxObj->setError($errorMsg);
     }
 }
 /**
  * Processes all AJAX calls and returns a JSON formatted string
  *
  * @param array $parameters
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxRequestHandler
  */
 public function processAjaxRequest($parameters, AjaxRequestHandler $ajaxRequestHandler)
 {
     // do the regular / main logic
     $this->initClipboard();
     $this->main();
     /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
     $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
     $content = array('redirect' => $this->redirect, 'messages' => array(), 'hasErrors' => FALSE);
     // Prints errors (= write them to the message queue)
     if ($this->prErr) {
         $content['hasErrors'] = TRUE;
         $this->tce->printLogErrorMessages($this->redirect);
     }
     $messages = $flashMessageService->getMessageQueueByIdentifier()->getAllMessagesAndFlush();
     if (!empty($messages)) {
         foreach ($messages as $message) {
             $content['messages'][] = array('title' => $message->getTitle(), 'message' => $message->getMessage(), 'severity' => $message->getSeverity());
             if ($message->getSeverity() === AbstractMessage::ERROR) {
                 $content['hasErrors'] = TRUE;
             }
         }
     }
     $ajaxRequestHandler->setContentFormat('json');
     $ajaxRequestHandler->setContent($content);
 }
 /**
  * Get the contacts for the given node for AJAX
  *
  * @param array $params
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj
  */
 public function ajaxGetNodeContacts($params, &$ajaxObj)
 {
     $node_id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('node');
     $node_repository = tx_caretaker_NodeRepository::getInstance();
     $node = $node_repository->id2node($node_id, true);
     if ($node_id && $node) {
         $count = 0;
         $contacts = array();
         $nodeContacts = $node->getContacts();
         /** @var tx_caretaker_Contact $nodeContact */
         foreach ($nodeContacts as $nodeContact) {
             $role = $nodeContact->getRole();
             if ($role) {
                 $role_assoc = array('uid' => $role->getUid(), 'id' => $role->getId(), 'name' => $role->getTitle(), 'description' => $role->getDescription());
             } else {
                 $role_assoc = array('uid' => '', 'id' => '', 'name' => '', 'description' => '');
             }
             $address = $nodeContact->getAddress();
             if ($address) {
                 $address['email_md5'] = md5($address['email']);
             }
             $contact = array('num' => $count++, 'id' => $node->getCaretakerNodeId() . '_role_' . $role_assoc['uid'] . '_address_' . $address['uid'], 'node_title' => $node->getTitle(), 'node_type' => $node->getType(), 'node_type_ll' => $node->getTypeDescription(), 'node_id' => $node->getCaretakerNodeId(), 'role' => $role_assoc, 'address' => $address);
             foreach ($address as $key => $value) {
                 $contact['address_' . $key] = $value;
             }
             foreach ($role_assoc as $key => $value) {
                 $contact['role_' . $key] = $value;
             }
             $contacts[] = $contact;
         }
         $content = array();
         $content['contacts'] = $contacts;
         $content['totalCount'] = $count;
         $ajaxObj->setContent($content);
         $ajaxObj->setContentFormat('jsonbody');
     }
 }
Example #15
0
 /**
  * Parses the ExtDirect configuration array "$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect']"
  * and feeds the given typo3ajax instance with the resulting information. The get parameter
  * "namespace" will be used to filter the configuration.
  *
  * This method makes usage of the reflection mechanism to fetch the methods inside the
  * defined classes together with their amount of parameters. This information are building
  * the API and are required by ExtDirect. The result is cached to improve the overall
  * performance.
  *
  * @param array $ajaxParams Ajax parameters
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj typo3ajax instance
  * @return void
  */
 public function getAPI($ajaxParams, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj)
 {
     $ajaxObj->setContent(array());
 }
Example #16
0
 /**
  * General processor for AJAX requests concerning IRRE.
  * (called by typo3/ajax.php)
  *
  * @param array $params Additional parameters (not used here)
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj The AjaxRequestHandler object of this request
  * @return void
  */
 public function processAjaxRequest($params, $ajaxObj)
 {
     $ajaxArguments = GeneralUtility::_GP('ajax');
     $ajaxIdParts = explode('::', $GLOBALS['ajaxID'], 2);
     if (isset($ajaxArguments) && is_array($ajaxArguments) && count($ajaxArguments)) {
         $ajaxMethod = $ajaxIdParts[1];
         switch ($ajaxMethod) {
             case 'createNewRecord':
             case 'synchronizeLocalizeRecords':
             case 'getRecordDetails':
                 $this->isAjaxCall = TRUE;
                 // Construct runtime environment for Inline Relational Record Editing:
                 $this->processAjaxRequestConstruct($ajaxArguments);
                 // Parse the DOM identifier (string), add the levels to the structure stack (array) and load the TCA config:
                 $this->parseStructureString($ajaxArguments[0], TRUE);
                 $this->injectAjaxConfiguration($ajaxArguments);
                 // Render content:
                 $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;
         }
     }
 }
 /**
  * The main dispatcher function. Collect data and prepare HTML output.
  *
  * @param array $params array of parameters from the AJAX interface, currently unused
  * @param AjaxRequestHandler $ajaxObj object of type AjaxRequestHandler
  * @return void
  */
 public function dispatch($params = array(), AjaxRequestHandler $ajaxObj = NULL)
 {
     $extPath = ExtensionManagementUtility::extPath('recycler');
     /* @var $view StandaloneView */
     $view = GeneralUtility::makeInstance(StandaloneView::class);
     $view->setPartialRootPaths(array('default' => $extPath . 'Resources/Private/Partials'));
     $content = '';
     // Determine the scripts to execute
     switch ($this->conf['action']) {
         case 'getTables':
             $this->setDataInSession('depthSelection', $this->conf['depth']);
             /* @var $model Tables */
             $model = GeneralUtility::makeInstance(Tables::class);
             $content = $model->getTables($this->conf['startUid'], $this->conf['depth']);
             break;
         case 'getDeletedRecords':
             $this->setDataInSession('tableSelection', $this->conf['table']);
             $this->setDataInSession('depthSelection', $this->conf['depth']);
             $this->setDataInSession('resultLimit', $this->conf['limit']);
             /* @var $model DeletedRecords */
             $model = GeneralUtility::makeInstance(DeletedRecords::class);
             $model->loadData($this->conf['startUid'], $this->conf['table'], $this->conf['depth'], $this->conf['start'] . ',' . $this->conf['limit'], $this->conf['filterTxt']);
             $deletedRowsArray = $model->getDeletedRows();
             $model = GeneralUtility::makeInstance(DeletedRecords::class);
             $totalDeleted = $model->getTotalCount($this->conf['startUid'], $this->conf['table'], $this->conf['depth'], $this->conf['filterTxt']);
             /* @var $controller DeletedRecordsController */
             $controller = GeneralUtility::makeInstance(DeletedRecordsController::class);
             $recordsArray = $controller->transform($deletedRowsArray, $totalDeleted);
             $modTS = $this->getBackendUser()->getTSConfig('mod.recycler');
             $allowDelete = (bool) $this->getBackendUser()->user['admin'] ? TRUE : (bool) $modTS['properties']['allowDelete'];
             $view->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/Ajax/RecordsTable.html');
             $view->assign('records', $recordsArray['rows']);
             $view->assign('allowDelete', $allowDelete);
             $view->assign('total', $recordsArray['total']);
             $content = array('rows' => $view->render(), 'totalItems' => $recordsArray['total']);
             break;
         case 'undoRecords':
             if (empty($this->conf['records']) || !is_array($this->conf['records'])) {
                 $content = array('success' => FALSE, 'message' => LocalizationUtility::translate('flashmessage.delete.norecordsselected', 'recycler'));
                 break;
             }
             /* @var $model DeletedRecords */
             $model = GeneralUtility::makeInstance(DeletedRecords::class);
             $success = $model->undeleteData($this->conf['records'], $this->conf['recursive']);
             $affectedRecords = count($this->conf['records']);
             $messageKey = 'flashmessage.undo.' . ($success ? 'success' : 'failure') . '.' . ($affectedRecords === 1 ? 'singular' : 'plural');
             $content = array('success' => TRUE, 'message' => sprintf(LocalizationUtility::translate($messageKey, 'recycler'), $affectedRecords));
             break;
         case 'deleteRecords':
             if (empty($this->conf['records']) || !is_array($this->conf['records'])) {
                 $content = array('success' => FALSE, 'message' => LocalizationUtility::translate('flashmessage.delete.norecordsselected', 'recycler'));
                 break;
             }
             /* @var $model DeletedRecords */
             $model = GeneralUtility::makeInstance(DeletedRecords::class);
             $success = $model->deleteData($this->conf['records']);
             $affectedRecords = count($this->conf['records']);
             $messageKey = 'flashmessage.delete.' . ($success ? 'success' : 'failure') . '.' . ($affectedRecords === 1 ? 'singular' : 'plural');
             $content = array('success' => TRUE, 'message' => sprintf(LocalizationUtility::translate($messageKey, 'recycler'), $affectedRecords));
             break;
     }
     $ajaxObj->setContentFormat('json');
     $ajaxObj->setContent($content);
 }