45 $GLOBALS[
'LANG']->includeLLFile(
'EXT:lang/locallang_mod_web_perm.xlf');
61 $this->conf[
'new_owner_username'] = htmlspecialchars($temp_owner_data[$this->conf[
'new_owner_uid']][
'username']);
65 $this->conf[
'new_group_username'] = htmlspecialchars($temp_group_data[$this->conf[
'new_group_uid']][
'title']);
80 public function dispatch($params = array(), \
TYPO3\CMS\Core\Http\AjaxRequestHandler &
$ajaxObj = NULL) {
83 if ($this->conf[
'page'] > 0) {
87 $tce->stripslashes_values = 1;
89 switch ($this->conf[
'action']) {
90 case 'show_change_owner_selector':
91 $content = $this->
renderUserSelector($this->conf[
'page'], $this->conf[
'ownerUid'], $this->conf[
'username']);
94 if (is_int($this->conf[
'new_owner_uid'])) {
97 $data[
'pages'][$this->conf[
'page']][
'perms_userid'] = $this->conf[
'new_owner_uid'];
99 $tce->start($data, array());
100 $tce->process_datamap();
101 $content = self::renderOwnername($this->conf[
'page'], $this->conf[
'new_owner_uid'], $this->conf[
'new_owner_username']);
103 $ajaxObj->setError(
'An error occurred: No page owner uid specified.');
106 case 'show_change_group_selector':
107 $content = $this->
renderGroupSelector($this->conf[
'page'], $this->conf[
'groupUid'], $this->conf[
'groupname']);
110 if (is_int($this->conf[
'new_group_uid'])) {
113 $data[
'pages'][$this->conf[
'page']][
'perms_groupid'] = $this->conf[
'new_group_uid'];
115 $tce->start($data, array());
116 $tce->process_datamap();
117 $content = self::renderGroupname($this->conf[
'page'], $this->conf[
'new_group_uid'], $this->conf[
'new_group_username']);
119 $ajaxObj->setError(
'An error occurred: No page group uid specified.');
122 case 'toggle_edit_lock':
125 $data[
'pages'][$this->conf[
'page']][
'editlock'] = $this->conf[
'editLockState'] === 1 ? 0 : 1;
127 $tce->start($data, array());
128 $tce->process_datamap();
129 $content = $this->
renderToggleEditLock($this->conf[
'page'], $data[
'pages'][$this->conf[
'page']][
'editlock']);
132 if ($this->conf[
'mode'] ==
'delete') {
133 $this->conf[
'permissions'] = (int)($this->conf[
'permissions'] - $this->conf[
'bits']);
135 $this->conf[
'permissions'] = (int)($this->conf[
'permissions'] + $this->conf[
'bits']);
139 $data[
'pages'][$this->conf[
'page']][
'perms_' . $this->conf[
'who']] = $this->conf[
'permissions'];
141 $tce->start($data, array());
142 $tce->process_datamap();
143 $content = self::renderPermissions($this->conf[
'permissions'], $this->conf[
'page'], $this->conf[
'who']);
146 $ajaxObj->setError(
'This script cannot be called directly.');
148 $ajaxObj->addContent($this->conf[
'page'] .
'_' . $this->conf[
'who'], $content);
169 if (!
$GLOBALS[
'BE_USER']->isAdmin()) {
175 foreach ($beUsers as
$uid => $row) {
176 $selected =
$uid == $ownerUid ?
' selected="selected"' :
'';
177 $options .=
'<option value="' .
$uid .
'"' . $selected .
'>' . htmlspecialchars($row[
'username']) .
'</option>';
179 $elementId =
'o_' . $page;
180 $options =
'<option value="0"></option>' . $options;
181 $selector =
'<select name="new_page_owner" id="new_page_owner">' . $options .
'</select>';
182 $saveButton =
'<a onclick="WebPermissions.changeOwner(' . $page .
', ' . $ownerUid .
', \'' . $elementId .
'\');
" title="Change owner
">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-save') . '</a>'; 183 $cancelButton = '<a onclick="WebPermissions.restoreOwner(
' . $page . ',
' . $ownerUid . ', \
'' . ($username ==
'' ?
'<span class=not_set>[not set]</span>' : htmlspecialchars($username)) .
'\', \
'' . $elementId .
'\');
" title="Cancel
">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-close') . '</a>'; 184 $ret = $selector . $saveButton . $cancelButton; 196 protected function renderGroupSelector($page, $groupUid, $groupname = '') { 198 $beGroups = BackendUtility::getListGroupNames('title,uid'); 199 $beGroupKeys = array_keys($beGroups); 200 $beGroupsO = ($beGroups = BackendUtility::getGroupNames()); 201 if (!$GLOBALS['BE_USER']->isAdmin()) { 202 $beGroups = BackendUtility::blindGroupNames($beGroupsO, $beGroupKeys, 1); 206 // flag: is set if the page-groupid equals one from the group-list 208 // Loop through the groups 209 foreach ($beGroups as $uid => $row) { 210 if ($uid == $groupUid) { 212 $selected = ' selected="selected
"'; 216 $options .= '<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['title']) . '</option>'; 218 // If the group was not set AND there is a group for the page 219 if (!$userset && $groupUid) { 220 $options = '<option value="' . $groupUid . '" selected="selected
">' . htmlspecialchars($beGroupsO[$groupUid]['title']) . '</option>' . $options; 222 $elementId = 'g_' . $page; 223 $options = '<option value="0
"></option>' . $options; 224 $selector = '<select name="new_page_group
" id="new_page_group
">' . $options . '</select>'; 225 $saveButton = '<a onclick="WebPermissions.changeGroup(
' . $page . ',
' . $groupUid . ', \
'' . $elementId .
'\');
" title="Change group
">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-save') . '</a>'; 226 $cancelButton = '<a onclick="WebPermissions.restoreGroup(
' . $page . ',
' . $groupUid . ', \
'' . ($groupname ==
'' ?
'<span class=not_set>[not set]</span>' : htmlspecialchars($groupname)) .
'\', \
'' . $elementId .
'\');
" title="Cancel
">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-close') . '</a>'; 227 $ret = $selector . $saveButton . $cancelButton; 240 static public function renderOwnername($page, $ownerUid, $username, $validUser = TRUE) { 241 $elementId = 'o_' . $page; 242 $ret = '<span id="' . $elementId . '"><a class="ug_selector
" onclick="WebPermissions.showChangeOwnerSelector(
' . $page . ',
' . $ownerUid . ', \
'' . $elementId .
'\', \
'' . htmlspecialchars($username) .
'\');
">' . ($validUser ? ($username == '' ? '<span class=not_set>[' . $GLOBALS['LANG']->getLL('notSet') . ']</span>' : htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($username, 20))) : '<span class=not_set title="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($username, 20)) . '">[' . $GLOBALS['LANG']->getLL('deleted') . ']</span>') . '</a></span>'; 255 static public function renderGroupname($page, $groupUid, $groupname, $validGroup = TRUE) { 256 $elementId = 'g_' . $page; 257 $ret = '<span id="' . $elementId . '"><a class="ug_selector
" onclick="WebPermissions.showChangeGroupSelector(
' . $page . ',
' . $groupUid . ', \
'' . $elementId .
'\', \
'' . htmlspecialchars($groupname) .
'\');
">' . ($validGroup ? ($groupname == '' ? '<span class=not_set>[' . $GLOBALS['LANG']->getLL('notSet') . ']</span>' : htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($groupname, 20))) : '<span class=not_set title="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($groupname, 20)) . '">[' . $GLOBALS['LANG']->getLL('deleted') . ']</span>') . '</a></span>'; 268 protected function renderToggleEditLock($page, $editLockState) { 269 if ($editLockState === 1) { 270 $ret = '<a class="editlock
" onclick="WebPermissions.toggleEditLock(
' . $page . ', 1);
" title="The page and all content is locked
for editing by all non-Admin users.
">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-warning-lock') . '</a>'; 272 $ret = '<a class="editlock
" onclick="WebPermissions.toggleEditLock(
' . $page . ', 0);
" title="Enable the »Admin-only« edit lock
for this page
">[+]</a>'; 285 static public function renderPermissions($int, $pageId = 0, $who = 'user') { 287 $permissions = array(1, 16, 2, 4, 8); 288 foreach ($permissions as $permission) { 289 if ($int & $permission) { 290 $str .= \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-status-permission-granted', array( 292 'title' => $GLOBALS['LANG']->getLL($permission, TRUE), 293 'onclick' => 'WebPermissions.setPermissions(' . $pageId . ', ' . $permission . ', \'delete\', \'' . $who . '\', ' . $int . ');', 294 'style' => 'cursor:pointer' 297 $str .= \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-status-permission-denied', array( 299 'title' => $GLOBALS['LANG']->getLL($permission, TRUE), 300 'onclick' => 'WebPermissions.setPermissions(' . $pageId . ', ' . $permission . ', \'add\', \'' . $who . '\', ' . $int . ');', 301 'style' => 'cursor:pointer' 305 return '<span id="' . $pageId . '_
' . $who . '">' . $str . '</span>';
static blindUserNames($usernames, $groupArray, $excludeBlindedFlag=0)
static getGroupNames($fields='title, uid', $where='')
static makeInstance($className)
renderGroupSelector($page, $groupUid, $groupname='')
static getUserNames($fields='username, usergroup, usergroup_cached_list, uid', $where='')
renderToggleEditLock($page, $editLockState)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
renderUserSelector($page, $ownerUid, $username='')
if($ajaxRegistryEntry !==NULL) $ajaxObj