Beispiel #1
0
 /**
  * @param string $commandControllerClass
  * @param string $actionName
  * @return CommandTask
  */
 public static function registerForCommand($commandControllerClass, $actionName)
 {
     $cutoff = strrpos($commandControllerClass, '\\') + 1;
     $controllerName = substr($commandControllerClass, $cutoff, strlen($commandControllerClass) - $cutoff - 17);
     $task = new CommandTask($commandControllerClass . '->' . $actionName);
     $task->getTaskConfiguration()->setId($commandControllerClass . '->' . $actionName)->setLabel('Command')->setDescription($controllerName . '->' . $actionName);
     TaskManager::getInstance()->addTask($task);
     return $task;
 }
 /**
  * @param array $parameters
  * @return string
  */
 public function renderField(array $parameters)
 {
     $selectedValues = GeneralUtility::trimExplode(',', $parameters['row']['allowed_tasks']);
     $tasks = TaskManager::getInstance()->getTaskIds();
     $fieldName = $parameters['itemFormElName'];
     $html = sprintf('<div id="%s" class="form-group">', $parameters['itemFormElID']);
     foreach ($tasks as $taskId) {
         $task = TaskManager::getInstance()->getTaskById($taskId);
         if (!$task->getTaskConfiguration()->isAvailable()) {
             continue;
         }
         $html .= '<label class="help-block">';
         $html .= sprintf('<input type="checkbox" name="%s[]" value="%s" %s /> ', $fieldName, $taskId, in_array($taskId, $selectedValues) ? 'checked="checked"' : '');
         $html .= $task->getTaskConfiguration()->getLabel();
         $html .= '<br />';
         $html .= '<em class="text-muted">' . $task->getTaskConfiguration()->getDescription() . '</em>';
         $html .= '</label>';
     }
     $html .= '</div>';
     return $html;
 }
 /**
  * @return Response
  */
 public function handleIncomingRequest()
 {
     $controller = new RequestController(ClientManager::getInstance(), TaskManager::getInstance());
     return $controller->autoProcessRequest();
 }
Beispiel #4
0
if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}
if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_INSTALL)) {
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup('
		rpc = PAGE
		rpc {
			typeNum = 991
			config {
				no_cache = 1
				disableAllHeaderCode = 1
				additionalHeaders = Content-type:application/json
    			xhtml_cleaning = 0
    			admPanel = 0
    			debug = 0
			}
			headerData >
			10 = USER_INT
			10.userFunc = NamelessCoder\\Rpc\\RequestDispatcher->handleIncomingRequest
		}
	');
}
\NamelessCoder\Rpc\Manager\TaskManager::setInstance(new \NamelessCoder\Rpc\Implementation\TaskManagerImplementation());
\NamelessCoder\Rpc\Manager\ClientManager::setInstance(new \NamelessCoder\Rpc\Implementation\ClientManagerImplementation());
\NamelessCoder\Rpc\Manager\TaskManager::getInstance()->addTask(new \NamelessCoder\Rpc\Implementation\Task\HelpTask('help'));
\NamelessCoder\Rpc\Manager\TaskManager::getInstance()->addTask(new \NamelessCoder\Rpc\Implementation\Task\ListTask('list'));
\NamelessCoder\Rpc\Manager\TaskManager::getInstance()->addTask(new \NamelessCoder\Rpc\Implementation\Task\DemoTask('demo'));
\NamelessCoder\Rpc\Implementation\Task\CommandTask::registerForCommand(\TYPO3\CMS\Extensionmanager\Command\ExtensionCommandController::class, 'install')->setFieldTypeForArgument(\NamelessCoder\Rpc\Implementation\Field\AvailableExtensionsField::class, 'extensionKey');
\NamelessCoder\Rpc\Implementation\Task\CommandTask::registerForCommand(\TYPO3\CMS\Extensionmanager\Command\ExtensionCommandController::class, 'uninstall')->setFieldTypeForArgument(\NamelessCoder\Rpc\Implementation\Field\InstalledExtensionsField::class, 'extensionKey');
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = \NamelessCoder\Rpc\Backend\DataHandlerHook::class;
Beispiel #5
0
 /**
  * @param string $taskId
  * @return string
  */
 protected function getDescriptionForTask($taskId)
 {
     $taskConfiguration = TaskManager::getInstance()->getTaskById($taskId)->getTaskConfiguration();
     return sprintf('%s: %s', $taskConfiguration->getLabel(), $taskConfiguration->getDescription());
 }