2 namespace TYPO3\CMS\Feedit;
77 $this->cObj->start(array());
96 public function editPanel($content, array $conf, $currentRecord =
'', array $dataArr = array(), $table =
'', array $allow = array(), $newUID = 0, array $hiddenFields = array())
98 $hiddenFieldString = $command =
'';
101 $this->frontendController->set_no_cache(
'Frontend edit panel is shown',
true);
103 $formName =
'TSFE_EDIT_FORM_' . substr($this->frontendController->uniqueHash(), 0, 4);
104 $formTag =
'<form name="' . $formName .
'" id ="' . $formName .
'" action="' . htmlspecialchars(
GeneralUtility::getIndpEnv(
'REQUEST_URI')) .
'" method="post" enctype="multipart/form-data" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
105 $sortField =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'sortby'];
106 $labelField =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'label'];
107 $hideField =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'enablecolumns'][
'disabled'];
110 if (isset($allow[
'toolbar']) && $this->backendUser->adminPanel instanceof
AdminPanelView) {
111 $panel .= $this->backendUser->adminPanel->ext_makeToolBar();
113 if (isset($allow[
'edit'])) {
114 $icon =
'<span title="' . htmlspecialchars($this->backendUser->extGetLL(
'p_editRecord')) .
'">' . $this->iconFactory->getIcon(
'actions-document-open',
Icon::SIZE_SMALL)->render() .
'</span>';
115 $panel .= $this->
editPanelLinkWrap($icon, $formName,
'edit', $dataArr[
'_LOCALIZED_UID'] ? $table .
':' . $dataArr[
'_LOCALIZED_UID'] : $currentRecord);
118 if (isset($allow[
'move']) && $sortField && $this->backendUser->workspace === 0) {
119 $icon =
'<span title="' . htmlspecialchars($this->backendUser->extGetLL(
'p_moveUp')) .
'">' . $this->iconFactory->getIcon(
'actions-move-up',
Icon::SIZE_SMALL)->render() .
'</span>';
121 $icon =
'<span title="' . htmlspecialchars($this->backendUser->extGetLL(
'p_moveDown')) .
'">' . $this->iconFactory->getIcon(
'actions-move-down',
Icon::SIZE_SMALL)->render() .
'</span>';
126 if (isset($allow[
'hide']) && $hideField && $this->backendUser->workspace === 0 && !$dataArr[
'_LOCALIZED_UID']) {
127 if ($dataArr[$hideField]) {
128 $icon = $this->iconFactory->getIcon(
'actions-edit-unhide',
Icon::SIZE_SMALL)->render();
131 $icon = $this->iconFactory->getIcon(
'actions-edit-hide',
Icon::SIZE_SMALL)->render();
132 $panel .= $this->
editPanelLinkWrap($icon, $formName,
'hide',
'', $this->backendUser->extGetLL(
'p_hideConfirm'));
135 if (isset($allow[
'new'])) {
136 if ($table ===
'pages') {
137 $icon =
'<span title="' . htmlspecialchars($this->backendUser->extGetLL(
'p_newSubpage')) .
'">'
138 . $this->iconFactory->getIcon(
'actions-page-new',
Icon::SIZE_SMALL)->render()
142 $icon =
'<span title="' . htmlspecialchars($this->backendUser->extGetLL(
'p_newRecordAfter')) .
'">'
143 . $this->iconFactory->getIcon(
'actions-document-new',
Icon::SIZE_SMALL)->render()
145 $panel .= $this->
editPanelLinkWrap($icon, $formName,
'new', $currentRecord,
'', $newUID);
150 if (isset($allow[
'delete']) && $this->backendUser->workspace === 0 && !$dataArr[
'_LOCALIZED_UID']) {
151 $icon =
'<span title="' . htmlspecialchars($this->backendUser->extGetLL(
'p_delete')) .
'">'
152 . $this->iconFactory->getIcon(
'actions-edit-delete',
Icon::SIZE_SMALL)->render()
154 $panel .= $this->
editPanelLinkWrap($icon, $formName,
'delete',
'', $this->backendUser->extGetLL(
'p_deleteConfirm'));
157 $labelTxt = $this->cObj->stdWrap($conf[
'label'], $conf[
'label.']);
158 foreach ((array)$hiddenFields as $name => $value) {
159 $hiddenFieldString .=
'<input type="hidden" name="TSFE_EDIT[' . htmlspecialchars($name) .
']" value="' . htmlspecialchars($value) .
'"/>' . LF;
162 $panel =
'<!-- BE_USER Edit Panel: -->
163 ' . $formTag . $hiddenFieldString .
'
164 <input type="hidden" name="TSFE_EDIT[cmd]" value="" />
165 <input type="hidden" name="TSFE_EDIT[record]" value="' . $currentRecord .
'" />
166 <div class="typo3-editPanel">'
167 .
'<div class="btn-group">'
170 ($labelTxt ?
'<div class="typo3-editPanel-label">' . sprintf($labelTxt, htmlspecialchars(
GeneralUtility::fixed_lgd_cs($dataArr[$labelField], 50))) .
'</div>' :
'') .
'
175 if ($conf[
'innerWrap']) {
176 $panel = $this->cObj->wrap($panel, $conf[
'innerWrap']);
178 if ($conf[
'innerWrap.']) {
179 $panel = $this->cObj->stdWrap($panel, $conf[
'innerWrap.']);
183 if ($conf[
'outerWrap']) {
184 $panel = $this->cObj->wrap($panel, $conf[
'outerWrap']);
186 if ($conf[
'outerWrap.']) {
187 $panel = $this->cObj->stdWrap($panel, $conf[
'outerWrap.']);
189 if ($conf[
'printBeforeContent']) {
190 $finalOut = $panel . $content;
192 $finalOut = $content . $panel;
195 $hidden = $this->
isDisabled($table, $dataArr) ?
' typo3-feedit-element-hidden' :
'';
196 $outerWrapConfig = isset($conf[
'stdWrap.'])
198 : array(
'wrap' =>
'<div class="typo3-feedit-element' . $hidden .
'">|</div>');
199 $finalOut = $this->cObj->stdWrap($finalOut, $outerWrapConfig);
219 public function editIcons($content, $params, array $conf = array(), $currentRecord =
'', array $dataArr = array(), $addUrlParamStr =
'', $table, $editUid, $fieldList)
222 $this->frontendController->set_no_cache(
'Display frontend edit icons',
true);
223 $iconTitle = $this->cObj->stdWrap($conf[
'iconTitle'], $conf[
'iconTitle.']);
224 $iconImg =
'<span title="' . htmlspecialchars($iconTitle, ENT_COMPAT,
'UTF-8',
false) .
'" class="frontEndEditIcons" style="' . ($conf[
'styleAttribute'] ? htmlspecialchars($conf[
'styleAttribute']) :
'') .
'">'
225 . $this->iconFactory->getIcon(
'actions-document-open',
Icon::SIZE_SMALL)->render()
229 $url = BackendUtility::getModuleUrl(
232 'edit[' . $table .
'][' . $editUid .
']' =>
'edit',
233 'columnsOnly' => $fieldList,
239 if ($conf[
'beforeLastTag'] < 0) {
240 $content = $icon . $content;
241 }
elseif ($conf[
'beforeLastTag'] > 0) {
242 $cBuf = rtrim($content);
244 while ($secureCount && substr($cBuf, -1) ==
'>' && substr($cBuf, -4) !=
'</a>') {
245 $cBuf = rtrim(preg_replace(
'/<[^<]*>$/',
'', $cBuf));
248 $content = strlen($cBuf) && $secureCount ? substr($content, 0, strlen($cBuf)) . $icon . substr($content, strlen($cBuf)) : ($content = $icon . $content);
267 protected function editPanelLinkWrap($string, $formName, $cmd, $currentRecord =
'', $confirm =
'', $nPid =
'')
270 if ($cmd ==
'edit') {
271 $rParts = explode(
':', $currentRecord);
272 $out = $this->
editPanelLinkWrap_doWrap($string, BackendUtility::getModuleUrl(
'record_edit', array(
'edit[' . $rParts[0] .
'][' . $rParts[1] .
']' =>
'edit',
'noView' => $nV,
'feEdit' => 1)), $currentRecord);
273 }
elseif ($cmd ==
'new') {
274 $rParts = explode(
':', $currentRecord);
275 if ($rParts[0] ==
'pages') {
276 $out = $this->
editPanelLinkWrap_doWrap($string, BackendUtility::getModuleUrl(
'db_new', [
'id' => $rParts[1],
'pagesOnly' => 1]), $currentRecord);
281 $out = $this->
editPanelLinkWrap_doWrap($string, BackendUtility::getModuleUrl(
'record_edit', array(
'edit[' . $rParts[0] .
'][' . $nPid .
']' =>
'new',
'noView' => $nV)), $currentRecord);
291 $out =
'<a href="#" class="btn btn-default btn-sm" onclick="' . htmlspecialchars(($cf1 .
'document.' . $formName .
'[\'TSFE_EDIT[cmd]\'].value=\'' . $cmd .
'\'; document.
' . $formName . '.submit();
' . $cf2 . ' return false;
')) . '">' . $string . '</a>';
305 protected function editPanelLinkWrap_doWrap($string, $url, $additionalClasses = '')
307 $onclick = 'vHWin=window.open(' . GeneralUtility::quoteJSvalue($url . '&returnUrl=sysext/backend/Resources/Private/Templates/Close.html') . ',\'FEquickEditWindow\',\'width=690,height=500,status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;';
308 return '<a href="#
" class="btn btn-
default btn-sm
' . htmlspecialchars($additionalClasses) . '" onclick="' . htmlspecialchars($onclick) . '" class="frontEndEditIconLinks
">' . $string . '</a>';
318 protected function isDisabled($table, array $row)
322 $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'] &&
323 $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']] ||
324 $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['fe_group'] &&
325 $this->frontendController->simUserGroup &&
326 $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['fe_group']] == $this->frontendController->simUserGroup ||
327 $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['starttime'] &&
328 $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['starttime']] > $GLOBALS['EXEC_TIME'] ||
329 $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime'] &&
330 $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime']] &&
331 $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime']] < $GLOBALS['EXEC_TIME']