2 namespace TYPO3\CMS\Workspaces\ExtDirect;
55 'result' => $integrity->getStatusRepresentation()
69 $pageId = $parameter->id > 0 ? $parameter->id : -1;
70 if (!isset($parameter->language) || !\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($parameter->language)) {
71 $parameter->language = null;
84 public function getHistory($parameters)
88 $history = $historyService->getHistory($parameters->table, $parameters->liveId);
91 'total' => count($history)
109 'total' => count($stages),
121 public function getRowDetails($parameter)
123 $diffReturnArray = array();
124 $liveReturnArray = array();
132 $icon_Live = $iconFactory->getIconForRecord($parameter->table, $liveRecord,
Icon::SIZE_SMALL)->render();
133 $icon_Workspace = $iconFactory->getIconForRecord($parameter->table, $versionRecord,
Icon::SIZE_SMALL)->render();
134 $stagePosition = $this->
getStagesService()->getPositionOfCurrentStage($parameter->stage);
135 $fieldsOfRecords = array_keys($liveRecord);
136 if (
$GLOBALS[
'TCA'][$parameter->table]) {
137 if (
$GLOBALS[
'TCA'][$parameter->table][
'interface'][
'showRecordFieldList']) {
138 $fieldsOfRecords =
$GLOBALS[
'TCA'][$parameter->table][
'interface'][
'showRecordFieldList'];
142 foreach ($fieldsOfRecords as $fieldName) {
143 if (empty(
$GLOBALS[
'TCA'][$parameter->table][
'columns'][$fieldName][
'config'])) {
148 if (empty($fieldTitle)) {
149 $fieldTitle = $fieldName;
152 $configuration =
$GLOBALS[
'TCA'][$parameter->table][
'columns'][$fieldName][
'config'];
154 if (
$GLOBALS[
'BE_USER']->isAdmin() ||
$GLOBALS[
'TCA'][$parameter->table][
'columns'][$fieldName][
'exclude'] == 0 ||
GeneralUtility::inList(
$GLOBALS[
'BE_USER']->groupData[
'non_exclude_fields'], $parameter->table .
':' . $fieldName)) {
156 if ($configuration[
'type'] ===
'inline' && $configuration[
'foreign_table'] ===
'sys_file_reference') {
157 $useThumbnails =
false;
158 if (!empty($configuration[
'foreign_selector_fieldTcaOverride'][
'config'][
'appearance'][
'elementBrowserAllowed']) && !empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'imagefile_ext'])) {
160 $allowedExtensions =
GeneralUtility::trimExplode(
',', $configuration[
'foreign_selector_fieldTcaOverride'][
'config'][
'appearance'][
'elementBrowserAllowed'],
true);
161 $differentExtensions = array_diff($allowedExtensions, $fileExtensions);
162 $useThumbnails = empty($differentExtensions);
165 $liveFileReferences = BackendUtility::resolveFileReferences(
171 $versionFileReferences = BackendUtility::resolveFileReferences(
175 $this->getCurrentWorkspace()
177 $fileReferenceDifferences = $this->prepareFileReferenceDifferences(
179 $versionFileReferences,
183 if ($fileReferenceDifferences === null) {
187 $diffReturnArray[] = array(
188 'field' => $fieldName,
189 'label' => $fieldTitle,
190 'content' => $fileReferenceDifferences[
'differences']
192 $liveReturnArray[] = array(
193 'field' => $fieldName,
194 'label' => $fieldTitle,
195 'content' => $fileReferenceDifferences[
'live']
197 }
elseif ((
string)$liveRecord[$fieldName] !== (
string)$versionRecord[$fieldName]) {
199 $liveRecord[$fieldName] = BackendUtility::getProcessedValue(
202 $liveRecord[$fieldName],
208 $versionRecord[$fieldName] = BackendUtility::getProcessedValue(
211 $versionRecord[$fieldName],
215 $versionRecord[
'uid']
218 if ($configuration[
'type'] ==
'group' && $configuration[
'internal_type'] ==
'file') {
219 $versionThumb = BackendUtility::thumbCode($versionRecord, $parameter->table, $fieldName,
'');
220 $liveThumb = BackendUtility::thumbCode($liveRecord, $parameter->table, $fieldName,
'');
221 $diffReturnArray[] = array(
222 'field' => $fieldName,
223 'label' => $fieldTitle,
224 'content' => $versionThumb
226 $liveReturnArray[] = array(
227 'field' => $fieldName,
228 'label' => $fieldTitle,
229 'content' => $liveThumb
232 $diffReturnArray[] = array(
233 'field' => $fieldName,
234 'label' => $fieldTitle,
235 'content' => $diffUtility->makeDiffDisplay($liveRecord[$fieldName], $versionRecord[$fieldName])
237 $liveReturnArray[] = array(
238 'field' => $fieldName,
239 'label' => $fieldTitle,
240 'content' => $parseObj->TS_images_rte($liveRecord[$fieldName])
248 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'workspaces'][
'modifyDifferenceArray'])) {
249 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'workspaces'][
'modifyDifferenceArray'] as $className) {
251 if (method_exists($hookObject,
'modifyDifferenceArray')) {
252 $hookObject->modifyDifferenceArray($parameter, $diffReturnArray, $liveReturnArray, $diffUtility);
261 'diff' => $diffReturnArray,
262 'live_record' => $liveReturnArray,
263 'path_Live' => $parameter->path_Live,
264 'label_Stage' => $parameter->label_Stage,
265 'stage_position' => $stagePosition[
'position'],
266 'stage_count' => $stagePosition[
'count'],
267 'comments' => $commentsForRecord,
268 'icon_Live' => $icon_Live,
269 'icon_Workspace' => $icon_Workspace
283 protected function prepareFileReferenceDifferences(array $liveFileReferences, array $versionFileReferences, $useThumbnails =
false)
285 $randomValue = uniqid(
'file');
287 $liveValues = array();
288 $versionValues = array();
289 $candidates = array();
290 $substitutes = array();
293 foreach ($liveFileReferences as $identifier => $liveFileReference) {
294 $identifierWithRandomValue = $randomValue .
'__' . $liveFileReference->getUid() .
'__' . $randomValue;
295 $candidates[$identifierWithRandomValue] = $liveFileReference;
296 $liveValues[] = $identifierWithRandomValue;
300 foreach ($versionFileReferences as $identifier => $versionFileReference) {
301 $identifierWithRandomValue = $randomValue .
'__' . $versionFileReference->getUid() .
'__' . $randomValue;
302 $candidates[$identifierWithRandomValue] = $versionFileReference;
303 $versionValues[] = $identifierWithRandomValue;
308 $liveInformation =
' ' . implode(
' ', $liveValues) .
' ';
309 $versionInformation =
' ' . implode(
' ', $versionValues) .
' ';
312 if ($liveInformation === $versionInformation) {
320 foreach ($candidates as $identifierWithRandomValue => $fileReference) {
321 if ($useThumbnails) {
322 $thumbnailFile = $fileReference->getOriginalFile()->process(
323 \TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW,
324 array(
'width' => 40,
'height' => 40)
326 $thumbnailMarkup =
'<img src="' . $thumbnailFile->getPublicUrl(
true) .
'" />';
327 $substitutes[$identifierWithRandomValue] = $thumbnailMarkup;
329 $substitutes[$identifierWithRandomValue] = $fileReference->getPublicUrl();
334 $liveInformation = str_replace(array_keys($substitutes), array_values($substitutes), trim($liveInformation));
335 $differences = str_replace(array_keys($substitutes), array_values($substitutes), trim($differences));
338 'live' => $liveInformation,
339 'differences' => $differences
352 $sysLogReturnArray = array();
353 $sysLogRows =
$GLOBALS[
'TYPO3_DB']->exec_SELECTgetRows(
354 'log_data,tstamp,userid',
356 'action=6 and details_nr=30 AND tablename=' .
$GLOBALS[
'TYPO3_DB']->fullQuoteStr($table,
'sys_log')
357 .
' AND recuid=' . (
int)$uid,
361 foreach ($sysLogRows as $sysLogRow) {
362 $sysLogEntry = array();
363 $data = unserialize($sysLogRow[
'log_data']);
365 $sysLogEntry[
'stage_title'] = $this->
getStagesService()->getStageTitle($data[
'stage']);
366 $sysLogEntry[
'user_uid'] = $sysLogRow[
'userid'];
367 $sysLogEntry[
'user_username'] = is_array($beUserRecord) ? $beUserRecord[
'username'] :
'';
369 $sysLogEntry[
'user_comment'] = $data[
'comment'];
370 $sysLogReturnArray[] = $sysLogEntry;
372 return $sysLogReturnArray;
383 $systemLanguages = array(
386 'title' => \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate(
'language.allLanguages',
'workspaces'),
394 $systemLanguages[] = array(
396 'title' => htmlspecialchars($systemLanguage[
'title']),
397 'icon' => $iconFactory->getIcon($systemLanguage[
'flagIcon'],
Icon::SIZE_SMALL)->render()
401 'total' => count($systemLanguages),
402 'data' => $systemLanguages
414 if (!isset($this->gridDataService)) {
427 if (!isset($this->stagesService)) {
440 if (!isset($this->differenceHandler)) {
441 $granularity = new \cogpowered\FineDiff\Granularity\Word();
442 $this->differenceHandler = new \cogpowered\FineDiff\Diff($granularity);