2 namespace TYPO3\CMS\Beuser\Controller;
82 $view->assign(
'pageId', $this->conf[
'page']);
86 if ($this->conf[
'page'] > 0) {
90 $tce->stripslashes_values =
false;
92 switch ($this->conf[
'action']) {
93 case 'show_change_owner_selector':
94 $content = $this->
renderUserSelector($this->conf[
'page'], $this->conf[
'ownerUid'], $this->conf[
'username']);
97 $userId = $this->conf[
'new_owner_uid'];
98 if (is_int($userId)) {
101 $data[
'pages'][$this->conf[
'page']][
'perms_userid'] = $userId;
103 $tce->start($data, array());
104 $tce->process_datamap();
106 $view->setTemplatePathAndFilename($extPath .
'Resources/Private/Templates/PermissionAjax/ChangeOwner.html');
107 $view->assign(
'userId', $userId);
109 $view->assign(
'username', $usernameArray[$userId][
'username']);
110 $content = $view->render();
112 $response->
getBody()->write(
'An error occurred: No page owner uid specified');
116 case 'show_change_group_selector':
117 $content = $this->
renderGroupSelector($this->conf[
'page'], $this->conf[
'groupUid'], $this->conf[
'groupname']);
120 $groupId = $this->conf[
'new_group_uid'];
121 if (is_int($groupId)) {
124 $data[
'pages'][$this->conf[
'page']][
'perms_groupid'] = $groupId;
126 $tce->start($data, array());
127 $tce->process_datamap();
129 $view->setTemplatePathAndFilename($extPath .
'Resources/Private/Templates/PermissionAjax/ChangeGroup.html');
130 $view->assign(
'groupId', $groupId);
132 $view->assign(
'groupname', $groupnameArray[$groupId][
'title']);
133 $content = $view->render();
135 $response->
getBody()->write(
'An error occurred: No page group uid specified');
139 case 'toggle_edit_lock':
142 $data[
'pages'][$this->conf[
'page']][
'editlock'] = $this->conf[
'editLockState'] === 1 ? 0 : 1;
144 $tce->start($data, array());
145 $tce->process_datamap();
146 $content = $this->
renderToggleEditLock($this->conf[
'page'], $data[
'pages'][$this->conf[
'page']][
'editlock']);
149 if ($this->conf[
'mode'] ===
'delete') {
150 $this->conf[
'permissions'] = (int)($this->conf[
'permissions'] - $this->conf[
'bits']);
152 $this->conf[
'permissions'] = (int)($this->conf[
'permissions'] + $this->conf[
'bits']);
156 $data[
'pages'][$this->conf[
'page']][
'perms_' . $this->conf[
'who']] = $this->conf[
'permissions'];
158 $tce->start($data, array());
159 $tce->process_datamap();
161 $view->setTemplatePathAndFilename($extPath .
'Resources/Private/Templates/PermissionAjax/ChangePermission.html');
162 $view->assign(
'permission', $this->conf[
'permissions']);
163 $view->assign(
'scope', $this->conf[
'who']);
164 $content = $view->render();
167 $response->
getBody()->write(
'This script cannot be called directly');
170 $response->
getBody()->write($content);
171 $response = $response->
withHeader(
'Content-Type',
'text/html; charset=utf-8');
186 $ownerUid = (int)$ownerUid;
192 foreach ($beUsers as $uid => $row) {
194 $selected = $uid === $ownerUid ?
' selected="selected"' :
'';
195 $options .=
'<option value="' . $uid .
'"' . $selected .
'>' . htmlspecialchars($row[
'username']) .
'</option>';
197 $elementId =
'o_' . $page;
198 $options =
'<option value="0"></option>' . $options;
199 $selector =
'<select name="new_page_owner" id="new_page_owner">' . $options .
'</select>';
200 $saveButton =
'<a class="saveowner btn btn-default" data-page="' . $page .
'" data-owner="' . $ownerUid .
'" data-element-id="' . $elementId .
'" title="Change owner">' . $this->iconFactory->getIcon(
'actions-document-save',
Icon::SIZE_SMALL)->render() .
'</a>';
201 $cancelButton =
'<a class="restoreowner btn btn-default" data-page="' . $page .
'" data-owner="' . $ownerUid .
'" data-element-id="' . $elementId .
'"' . (!empty($username) ?
' data-username="' . htmlspecialchars($username) .
'"' :
'') .
' title="Cancel">' . $this->iconFactory->getIcon(
'actions-document-close',
Icon::SIZE_SMALL)->render() .
'</a>';
202 return '<span id="' . $elementId .
'">'
204 .
'<span class="btn-group">'
222 $groupUid = (int)$groupUid;
231 foreach ($beGroups as $uid => $row) {
233 if ($uid === $groupUid) {
235 $selected =
' selected="selected"';
239 $options .=
'<option value="' . $uid .
'"' . $selected .
'>' . htmlspecialchars($row[
'title']) .
'</option>';
242 if (!$userset && $groupUid) {
243 $options =
'<option value="' . $groupUid .
'" selected="selected">' .
244 htmlspecialchars($beGroupsO[$groupUid][
'title']) .
'</option>' . $options;
246 $elementId =
'g_' . $page;
247 $options =
'<option value="0"></option>' . $options;
248 $selector =
'<select name="new_page_group" id="new_page_group">' . $options .
'</select>';
249 $saveButton =
'<a class="savegroup btn btn-default" data-page="' . $page .
'" data-group="' . $groupUid .
'" data-element-id="' . $elementId .
'" title="Change group">' . $this->iconFactory->getIcon(
'actions-document-save',
Icon::SIZE_SMALL)->render() .
'</a>';
250 $cancelButton =
'<a class="restoregroup btn btn-default" data-page="' . $page .
'" data-group="' . $groupUid .
'" data-element-id="' . $elementId .
'"' . (!empty($groupname) ?
' data-groupname="' . htmlspecialchars($groupname) .
'"' :
'') .
' title="Cancel">' . $this->iconFactory->getIcon(
'actions-document-close',
Icon::SIZE_SMALL)->render() .
'</a>';
251 return '<span id="' . $elementId .
'">'
253 .
'<span class="btn-group">'
270 public static function renderOwnername($page, $ownerUid, $username, $validUser =
true)
273 $elementId =
'o_' . $page;
274 return '<span id="' . $elementId .
'"><a class="ug_selector changeowner" data-page="' . $page .
'" data-owner="' . $ownerUid .
'" data-username="' . htmlspecialchars($username) .
'">' . ($validUser ? ($username ==
'' ?
'<span class=not_set>[' .
$GLOBALS[
'LANG']->getLL(
'notSet') .
']</span>' : htmlspecialchars(
GeneralUtility::fixed_lgd_cs($username, 20))) :
'<span class=not_set title="' . htmlspecialchars(
GeneralUtility::fixed_lgd_cs($username, 20)) .
'">[' .
$GLOBALS[
'LANG']->getLL(
'deleted') .
']</span>') .
'</a></span>';
287 public static function renderGroupname($page, $groupUid, $groupname, $validGroup =
true)
290 $elementId =
'g_' . $page;
291 return '<span id="' . $elementId .
'"><a class="ug_selector changegroup" data-page="' . $page .
'" data-group="' . $groupUid .
'" data-groupname="' . htmlspecialchars($groupname) .
'">' . ($validGroup ? ($groupname ==
'' ?
'<span class=not_set>[' .
$GLOBALS[
'LANG']->getLL(
'notSet') .
']</span>' : htmlspecialchars(
GeneralUtility::fixed_lgd_cs($groupname, 20))) :
'<span class=not_set title="' . htmlspecialchars(
GeneralUtility::fixed_lgd_cs($groupname, 20)) .
'">[' .
$GLOBALS[
'LANG']->getLL(
'deleted') .
']</span>') .
'</a></span>';
304 if ($editLockState === 1) {
305 $ret =
'<span id="el_' . $page .
'"><a class="editlock btn btn-default" data-page="' . $page .
'" data-lockstate="1" title="The page and all content is locked for editing by all non-Admin users.">' . $this->iconFactory->getIcon(
'actions-lock',
Icon::SIZE_SMALL)->render() .
'</a></span>';
307 $ret =
'<span id="el_' . $page .
'"><a class="editlock btn btn-default" data-page="' . $page .
'" data-lockstate="0" title="Enable the »Admin-only« edit lock for this page">' . $this->iconFactory->getIcon(
'actions-unlock',
Icon::SIZE_SMALL)->render() .
'</a></span>';
321 public static function renderPermissions($int, $pageId = 0, $who =
'user')
325 $permissions = array(1, 16, 2, 4, 8);
328 foreach ($permissions as $permission) {
329 if ($int & $permission) {
330 $str .=
'<span title="' .
$GLOBALS[
'LANG']->getLL($permission,
true)
331 .
' class="change-permission text-success"'
332 .
' data-page="' . (int)$pageId .
'"'
333 .
' data-permissions="' . (
int)$int .
'"'
334 .
' data-mode="delete"'
335 .
' data-who="' . htmlspecialchars($who) .
'"'
336 .
' data-bits="' . $permission .
'"'
337 .
' style="cursor:pointer">'
341 $str .=
'<span title="' .
$GLOBALS[
'LANG']->getLL($permission,
true) .
'"'
342 .
' class="change-permission text-danger"'
343 .
' data-page="' . (int)$pageId .
'"'
344 .
' data-permissions="' . (
int)$int .
'"'
346 .
' data-who="' . htmlspecialchars($who) .
'"'
347 .
' data-bits="' . $permission .
'"'
348 .
' style="cursor:pointer">'
353 return '<span id="' . $pageId .
'_' . $who .
'">' . $str .
'</span>';