69 $versionRecord = BackendUtility::getRecord($table, $orig_uid);
72 $cmd[$table][$t3ver_oid][
'version'] = array(
74 'swapWith' => $orig_uid,
77 $this->processTcaCmd($cmd);
91 $versionRecord = BackendUtility::getRecord($table,
$uid);
94 $cmd[$table][
$uid][
'version'] = array(
95 'action' =>
'clearWSID' 97 $this->processTcaCmd($cmd);
110 return \TYPO3\CMS\Workspaces\Service\WorkspaceService::viewSingleRecord($table,
$uid);
122 if (empty($parameter->action) || empty($parameter->selection)) {
123 $result[
'error'] =
'No action or record selection given';
128 $swapIntoWorkspace = ($parameter->action ===
'swap');
129 if ($parameter->action ===
'publish' || $swapIntoWorkspace) {
131 } elseif ($parameter->action ===
'discard') {
135 $result = $this->processTcaCmd($commands);
136 $result[
'total'] = count($commands);
149 foreach ($selection as $record) {
150 $commands[$record->table][$record->liveId][
'version'] = array(
152 'swapWith' => $record->versionId,
153 'swapIntoWS' => (
bool)$swapIntoWorkspace,
167 foreach ($selection as $record) {
168 $commands[$record->table][$record->versionId][
'version'] = array(
169 'action' =>
'clearWSID',
183 foreach ($model as $column) {
184 $data[$column->column] = array(
185 'position' => $column->position,
186 'hidden' => $column->hidden
189 $GLOBALS[
'BE_USER']->uc[
'moduleData'][
'Workspaces'][
$GLOBALS[
'BE_USER']->workspace][
'columns'] = $data;
194 if (is_array(
$GLOBALS[
'BE_USER']->uc[
'moduleData'][
'Workspaces'][
$GLOBALS[
'BE_USER']->workspace][
'columns'])) {
195 return $GLOBALS[
'BE_USER']->uc[
'moduleData'][
'Workspaces'][
$GLOBALS[
'BE_USER']->workspace][
'columns'];
208 if (\
TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($language) === FALSE && $language !==
'all') {
211 $GLOBALS[
'BE_USER']->uc[
'moduleData'][
'Workspaces'][
$GLOBALS[
'BE_USER']->workspace][
'language'] = $language;
224 $elementRecord = BackendUtility::getRecord($table,
$uid);
227 if (is_array($elementRecord)) {
228 $stageId = $elementRecord[
't3ver_stage'];
234 'nextStage' => $nextStage[
'uid'],
235 't3ver_oid' => $t3ver_oid,
257 $elementRecord = BackendUtility::getRecord($table,
$uid);
260 if (is_array($elementRecord)) {
261 $stageId = $elementRecord[
't3ver_stage'];
263 if ($stageId !== \
TYPO3\CMS\Workspaces\Service\StagesService::STAGE_EDIT_ID) {
269 'nextStage' => $prevStage[
'uid']
295 'nextStage' => $nextStageId
308 public function getRecipientList(array $uidOfRecipients, $additionalRecipients, $stageId) {
309 $finalRecipients = array();
311 throw new \InvalidArgumentException(
$GLOBALS[
'LANG']->sL(
'LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:error.stageId.integer'));
313 $stageId = (int)$stageId;
315 $recipients = array();
316 foreach ($uidOfRecipients as $userUid) {
317 $beUserRecord = BackendUtility::getRecord(
'be_users', (
int)$userUid);
318 if (is_array($beUserRecord) && $beUserRecord[
'email'] !==
'') {
319 $uc = $beUserRecord[
'uc'] ? unserialize($beUserRecord[
'uc']) : array();
320 $recipients[$beUserRecord[
'email']] = array(
321 'email' => $beUserRecord[
'email'],
322 'lang' => isset($uc[
'lang']) ? $uc[
'lang'] : $beUserRecord[
'lang']
327 $notification_mode = (int)$this->
getStageService()->getNotificationMode($stageId);
328 if ($notification_mode === \
TYPO3\CMS\Workspaces\Service\StagesService::MODE_NOTIFY_ALL || $notification_mode === \
TYPO3\CMS\Workspaces\Service\StagesService::MODE_NOTIFY_ALL_STRICT) {
331 $default_recipients = $this->
getStageService()->getResponsibleBeUser($stageId, TRUE);
332 foreach ($default_recipients as $default_recipient_uid => $default_recipient_record) {
333 if (!isset($recipients[$default_recipient_record[
'email']])) {
334 $uc = $default_recipient_record[
'uc'] ? unserialize($default_recipient_record[
'uc']) : array();
335 $recipients[$default_recipient_record[
'email']] = array(
336 'email' => $default_recipient_record[
'email'],
337 'lang' => isset($uc[
'lang']) ? $uc[
'lang'] : $default_recipient_record[
'lang']
342 if ($additionalRecipients !==
'') {
344 $additionalRecipients = array();
345 foreach ($emails as $email) {
346 $additionalRecipients[$email] = array(
'email' => $email);
349 $additionalRecipients = array();
355 $allRecipients = array_merge($additionalRecipients, $recipients);
356 foreach ($allRecipients as $email => $recipientInformation) {
358 $finalRecipients[] = $recipientInformation;
361 return $finalRecipients;
371 public function discardStagesFromPage($pageId) {
372 $cmdMapArray = array();
377 $workspaceItemsArray = $workspaceService->selectVersionsInWorkspace(
$stageService->getWorkspaceId(), ($filter = 1), ($stage = -99), $pageId, ($recursionLevel = 0), ($selectionType =
'tables_modify'));
378 foreach ($workspaceItemsArray as $tableName => $items) {
379 foreach ($items as $item) {
380 $cmdMapArray[$tableName][$item[
'uid']][
'version'][
'action'] =
'clearWSID';
383 $this->processTcaCmd($cmdMapArray);
405 $cmdMapArray = array();
406 $comment = $parameters->comments;
407 $stageId = $parameters->stageId;
408 if (\
TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($stageId) === FALSE) {
409 throw new \InvalidArgumentException(
'Missing "stageId" in $parameters array.', 1319488194);
411 if (!is_object($parameters->affects) || count($parameters->affects) == 0) {
412 throw new \InvalidArgumentException(
'Missing "affected items" in $parameters array.', 1319488195);
414 $recipients = $this->
getRecipientList($parameters->receipients, $parameters->additional, $stageId);
415 foreach ($parameters->affects as $tableName => $items) {
416 foreach ($items as $item) {
418 if ($stageId == \
TYPO3\CMS\Workspaces\Service\StagesService::STAGE_PUBLISH_EXECUTE_ID) {
419 $cmdMapArray[$tableName][$item->t3ver_oid][
'version'][
'action'] =
'swap';
420 $cmdMapArray[$tableName][$item->t3ver_oid][
'version'][
'swapWith'] = $item->uid;
421 $cmdMapArray[$tableName][$item->t3ver_oid][
'version'][
'comment'] = $comment;
422 $cmdMapArray[$tableName][$item->t3ver_oid][
'version'][
'notificationAlternativeRecipients'] = $recipients;
425 $cmdMapArray[$tableName][$item->uid][
'version'][
'action'] =
'setStage';
426 $cmdMapArray[$tableName][$item->uid][
'version'][
'stageId'] = $stageId;
427 $cmdMapArray[$tableName][$item->uid][
'version'][
'comment'] = $comment;
428 $cmdMapArray[$tableName][$item->uid][
'version'][
'notificationAlternativeRecipients'] = $recipients;
432 $this->processTcaCmd($cmdMapArray);
436 'refreshLivePanel' => $parameters->stageId == -20 ? TRUE : FALSE
447 protected function processTcaCmd(array $cmdMapArray) {
450 if (empty($cmdMapArray)) {
451 $result[
'error'] =
'No commands given to be processed';
457 $dataHandler->start(array(), $cmdMapArray);
458 $dataHandler->process_cmdmap();
460 if ($dataHandler->errorLog) {
461 $result[
'error'] = implode(
'<br/>', $dataHandler->errorLog);
484 $setStageId = $parameters->affects->nextStage;
485 $comments = $parameters->comments;
486 $table = $parameters->affects->table;
487 $uid = $parameters->affects->uid;
488 $t3ver_oid = $parameters->affects->t3ver_oid;
490 $elementRecord = BackendUtility::getRecord($table,
$uid);
493 $recipients = $this->
getRecipientList($parameters->receipients, $parameters->additional, $setStageId);
494 if ($setStageId == \
TYPO3\CMS\Workspaces\Service\StagesService::STAGE_PUBLISH_EXECUTE_ID) {
495 $cmdArray[$table][$t3ver_oid][
'version'][
'action'] =
'swap';
496 $cmdArray[$table][$t3ver_oid][
'version'][
'swapWith'] =
$uid;
497 $cmdArray[$table][$t3ver_oid][
'version'][
'comment'] = $comments;
498 $cmdArray[$table][$t3ver_oid][
'version'][
'notificationAlternativeRecipients'] = $recipients;
500 $cmdArray[$table][
$uid][
'version'][
'action'] =
'setStage';
501 $cmdArray[$table][
$uid][
'version'][
'stageId'] = $setStageId;
502 $cmdArray[$table][
$uid][
'version'][
'comment'] = $comments;
503 $cmdArray[$table][
$uid][
'version'][
'notificationAlternativeRecipients'] = $recipients;
505 $this->processTcaCmd($cmdArray);
530 $setStageId = $parameters->affects->nextStage;
531 $comments = $parameters->comments;
532 $table = $parameters->affects->table;
533 $uid = $parameters->affects->uid;
535 $elementRecord = BackendUtility::getRecord($table,
$uid);
538 $recipients = $this->
getRecipientList($parameters->receipients, $parameters->additional, $setStageId);
539 $cmdArray[$table][
$uid][
'version'][
'action'] =
'setStage';
540 $cmdArray[$table][
$uid][
'version'][
'stageId'] = $setStageId;
541 $cmdArray[$table][
$uid][
'version'][
'comment'] = $comments;
542 $cmdArray[$table][
$uid][
'version'][
'notificationAlternativeRecipients'] = $recipients;
543 $this->processTcaCmd($cmdArray);
575 $setStageId = $parameters->affects->nextStage;
576 $comments = $parameters->comments;
577 $elements = $parameters->affects->elements;
578 $recipients = $this->
getRecipientList($parameters->receipients, $parameters->additional, $setStageId);
579 foreach ($elements as $element) {
581 $elementRecord = BackendUtility::getRecord($element->table, $element->uid);
582 if ((
int)$elementRecord[
't3ver_wsid'] === 0) {
586 if ($setStageId == \
TYPO3\CMS\Workspaces\Service\StagesService::STAGE_PUBLISH_EXECUTE_ID) {
587 $cmdArray[$element->table][$element->t3ver_oid][
'version'][
'action'] =
'swap';
588 $cmdArray[$element->table][$element->t3ver_oid][
'version'][
'swapWith'] = $element->uid;
589 $cmdArray[$element->table][$element->t3ver_oid][
'version'][
'comment'] = $comments;
590 $cmdArray[$element->table][$element->t3ver_oid][
'version'][
'notificationAlternativeRecipients'] = $recipients;
592 $cmdArray[$element->table][$element->uid][
'version'][
'action'] =
'setStage';
593 $cmdArray[$element->table][$element->uid][
'version'][
'stageId'] = $setStageId;
594 $cmdArray[$element->table][$element->uid][
'version'][
'comment'] = $comments;
595 $cmdArray[$element->table][$element->uid][
'version'][
'notificationAlternativeRecipients'] = $recipients;
598 $this->processTcaCmd($cmdArray);
612 $workspaceRec = BackendUtility::getRecord(
'sys_workspace', $this->
getStageService()->getWorkspaceId());
613 $showNotificationFields = FALSE;
616 'title' =>
$GLOBALS[
'LANG']->sL(
'LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:actionSendToStage'),
620 'bodyStyle' =>
'margin-bottom: 7px; border: none;',
621 'html' =>
$GLOBALS[
'LANG']->sL(
'LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:window.sendToNextStageWindow.itemsWillBeSentTo') .
' ' . $stageTitle
625 switch ($nextStageId) {
626 case \TYPO3\CMS\Workspaces\Service\StagesService::STAGE_PUBLISH_EXECUTE_ID:
628 case \TYPO3\CMS\Workspaces\Service\StagesService::STAGE_PUBLISH_ID:
629 if (!empty($workspaceRec[
'publish_allow_notificaton_settings'])) {
630 $showNotificationFields = TRUE;
633 case \TYPO3\CMS\Workspaces\Service\StagesService::STAGE_EDIT_ID:
634 if (!empty($workspaceRec[
'edit_allow_notificaton_settings'])) {
635 $showNotificationFields = TRUE;
639 $allow_notificaton_settings = $this->
getStageService()->getPropertyOfCurrentWorkspaceStage($nextStageId,
'allow_notificaton_settings');
640 if (!empty($allow_notificaton_settings)) {
641 $showNotificationFields = TRUE;
644 if ($showNotificationFields == TRUE) {
646 'fieldLabel' =>
$GLOBALS[
'LANG']->sL(
'LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:window.sendToNextStageWindow.sendMailTo'),
647 'xtype' =>
'checkboxgroup',
648 'itemCls' =>
'x-check-group-alt',
650 'style' =>
'max-height: 200px',
651 'autoScroll' => TRUE,
657 'fieldLabel' =>
$GLOBALS[
'LANG']->sL(
'LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:window.sendToNextStageWindow.additionalRecipients'),
658 'name' =>
'additional',
659 'xtype' =>
'textarea',
664 'fieldLabel' =>
$GLOBALS[
'LANG']->sL(
'LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:window.sendToNextStageWindow.comments'),
665 'name' =>
'comments',
666 'xtype' =>
'textarea',
682 $default_recipients = $this->
getStageService()->getResponsibleBeUser($stage, TRUE);
683 foreach ($recipients as $id => $user) {
687 $name = $user[
'realName'] ? $user[
'realName'] : $user[
'username'];
689 $notification_mode = (int)$this->
getStageService()->getNotificationMode($stage);
690 if ($notification_mode === \
TYPO3\CMS\Workspaces\Service\StagesService::MODE_NOTIFY_SOMEONE) {
693 } elseif ($notification_mode === \
TYPO3\CMS\Workspaces\Service\StagesService::MODE_NOTIFY_ALL) {
695 if (!empty($default_recipients[$id])) {
701 } elseif ($notification_mode === \
TYPO3\CMS\Workspaces\Service\StagesService::MODE_NOTIFY_ALL_STRICT) {
707 'boxLabel' => sprintf(
'%s (%s)', $name, $user[
'email']),
708 'name' =>
'receipients-' . $id,
709 'checked' => $checked,
710 'disabled' => $disabled
734 if (!isset($this->stageService)) {
749 $workspaceItemsArray = $workspaceService->selectVersionsInWorkspace($this->stageService->getWorkspaceId(), ($filter = 1), ($stage = -99), $id, ($recursionLevel = 0), ($selectionType =
'tables_modify'));
750 list($currentStage, $previousStage) = $this->
getStageService()->getPreviousStageForElementCollection($workspaceItemsArray);
752 $workspaceItemsArray = $workspaceService->selectVersionsInWorkspace($this->stageService->getWorkspaceId(), ($filter = 1), $currentStage[
'uid'], $id, ($recursionLevel = 0), ($selectionType =
'tables_modify'));
754 'title' =>
'Status message: Page send to next stage - ID: ' . $id .
' - Next stage title: ' . $previousStage[
'title'],
756 'affects' => $workspaceItemsArray,
757 'stageId' => $previousStage[
'uid']
768 $workspaceItemsArray = $workspaceService->selectVersionsInWorkspace($this->stageService->getWorkspaceId(), ($filter = 1), ($stage = -99), $id, ($recursionLevel = 0), ($selectionType =
'tables_modify'));
769 list($currentStage, $nextStage) = $this->
getStageService()->getNextStageForElementCollection($workspaceItemsArray);
771 $workspaceItemsArray = $workspaceService->selectVersionsInWorkspace($this->stageService->getWorkspaceId(), ($filter = 1), $currentStage[
'uid'], $id, ($recursionLevel = 0), ($selectionType =
'tables_modify'));
773 'title' =>
'Status message: Page send to next stage - ID: ' . $id .
' - Next stage title: ' . $nextStage[
'title'],
775 'affects' => $workspaceItemsArray,
776 'stageId' => $nextStage[
'uid']
791 $workspaceItemsArray = $workspaceService->selectVersionsInWorkspace(
$stageService->getWorkspaceId(), ($filter = 1), ($stage = -99), $id, ($recursionLevel = 0), ($selectionType =
'tables_modify'));
792 list(, $nextStage) =
$stageService->getNextStageForElementCollection($workspaceItemsArray);
793 list(, $previousStage) =
$stageService->getPreviousStageForElementCollection($workspaceItemsArray);
794 $toolbarButtons = array(
795 'feToolbarButtonNextStage' => array(
796 'visible' => is_array($nextStage) && count($nextStage) > 0,
797 'text' => $nextStage[
'title']
799 'feToolbarButtonPreviousStage' => array(
800 'visible' => is_array($previousStage) && count($previousStage),
801 'text' => $previousStage[
'title']
803 'feToolbarButtonDiscardStage' => array(
804 'visible' => is_array($nextStage) && count($nextStage) > 0 || is_array($previousStage) && count($previousStage) > 0,
805 'text' =>
$GLOBALS[
'LANG']->sL(
'LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:label_doaction_discard', TRUE)
808 return $toolbarButtons;
817 $workspaceId = (int)$workspaceId;
820 if ($currentWorkspace !== $workspaceId) {
821 if (!$this->
getBackendUser()->setTemporaryWorkspace($workspaceId)) {
822 throw new \TYPO3\CMS\Core\Exception(
823 'Cannot set temporary workspace to "' . $workspaceId .
'"',
829 return $currentWorkspace;
viewSingleRecord($table, $uid)
getDefaultCommentOfStage($stage)
sendToNextStageWindow($uid, $table, $t3ver_oid)
sendPageToPreviousStage($id)
updateStageChangeButtons($id)
getFlushCommands(array $selection)
generateWorkspacePreviewLinksForAllLanguages($uid)
setTemporaryWorkspace($workspaceId)
static validEmail($email)
sendToPrevStageExecute(\stdClass $parameters)
getErrorResponse($errorLabel, $errorCode=0, $successFlagValue=FALSE)
getReceipientsOfStage($stage)
static makeInstance($className)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
executeSelectionAction($parameter)
deleteSingleRecord($table, $uid)
sendToNextStageExecute(\stdClass $parameters)
getRecipientList(array $uidOfRecipients, $additionalRecipients, $stageId)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
saveLanguageSelection($language)
getPublishSwapCommands(array $selection, $swapIntoWorkspace)
getSentToStageWindow($nextStageId)
sendToSpecificStageExecute(\stdClass $parameters)
generateWorkspacePreviewLink($uid)
sendToSpecificStageWindow($nextStageId)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
sendToPrevStageWindow($uid, $table)
sentCollectionToStage(\stdClass $parameters)
swapSingleRecord($table, $t3ver_oid, $orig_uid)