/**
     * Creating form for editing the permissions	($this->edit = true)
     * (Adding content to internal content variable)
     *
     * @return	void
     */
    public function doEdit()
    {
        global $BE_USER, $LANG;
        if ($BE_USER->workspace != 0) {
            // Adding section with the permission setting matrix:
            $lockedMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('WorkspaceWarningText'), $LANG->getLL('WorkspaceWarning'), t3lib_FlashMessage::WARNING);
            t3lib_FlashMessageQueue::addMessage($lockedMessage);
        }
        // Get usernames and groupnames
        $beGroupArray = t3lib_BEfunc::getListGroupNames('title,uid');
        $beGroupKeys = array_keys($beGroupArray);
        $beUserArray = t3lib_BEfunc::getUserNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $beUserArray = t3lib_BEfunc::blindUserNames($beUserArray, $beGroupKeys, 1);
        }
        $beGroupArray_o = $beGroupArray = t3lib_BEfunc::getGroupNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $beGroupArray = t3lib_BEfunc::blindGroupNames($beGroupArray_o, $beGroupKeys, 1);
        }
        $firstGroup = $beGroupKeys[0] ? $beGroupArray[$beGroupKeys[0]] : '';
        // data of the first group, the user is member of
        // Owner selector:
        $options = '';
        $userset = 0;
        // flag: is set if the page-userid equals one from the user-list
        foreach ($beUserArray as $uid => $row) {
            if ($uid == $this->pageinfo['perms_userid']) {
                $userset = 1;
                $selected = ' selected="selected"';
            } else {
                $selected = '';
            }
            $options .= '
				<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['username']) . '</option>';
        }
        $options = '
				<option value="0"></option>' . $options;
        $selector = '
			<select name="data[pages][' . $this->id . '][perms_userid]">
				' . $options . '
			</select>';
        $this->content .= $this->doc->section($LANG->getLL('Owner') . ':', $selector);
        // Group selector:
        $options = '';
        $userset = 0;
        foreach ($beGroupArray as $uid => $row) {
            if ($uid == $this->pageinfo['perms_groupid']) {
                $userset = 1;
                $selected = ' selected="selected"';
            } else {
                $selected = '';
            }
            $options .= '
				<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['title']) . '</option>';
        }
        if (!$userset && $this->pageinfo['perms_groupid']) {
            // If the group was not set AND there is a group for the page
            $options = '
				<option value="' . $this->pageinfo['perms_groupid'] . '" selected="selected">' . htmlspecialchars($beGroupArray_o[$this->pageinfo['perms_groupid']]['title']) . '</option>' . $options;
        }
        $options = '
				<option value="0"></option>' . $options;
        $selector = '
			<select name="data[pages][' . $this->id . '][perms_groupid]">
				' . $options . '
			</select>';
        $this->content .= $this->doc->divider(5);
        $this->content .= $this->doc->section($LANG->getLL('Group') . ':', $selector);
        // Permissions checkbox matrix:
        $code = '
			<table border="0" cellspacing="2" cellpadding="0" id="typo3-permissionMatrix">
				<tr>
					<td></td>
					<td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('1', 1)) . '</td>
					<td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('16', 1)) . '</td>
					<td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('2', 1)) . '</td>
					<td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('4', 1)) . '</td>
					<td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('8', 1)) . '</td>
				</tr>
				<tr>
					<td align="right" class="bgColor2">' . $LANG->getLL('Owner', 1) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_user', 1) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_user', 5) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_user', 2) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_user', 3) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_user', 4) . '</td>
				</tr>
				<tr>
					<td align="right" class="bgColor2">' . $LANG->getLL('Group', 1) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_group', 1) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_group', 5) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_group', 2) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_group', 3) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_group', 4) . '</td>
				</tr>
				<tr>
					<td align="right" class="bgColor2">' . $LANG->getLL('Everybody', 1) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 1) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 5) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 2) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 3) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 4) . '</td>
				</tr>
			</table>
			<br />

			<input type="hidden" name="data[pages][' . $this->id . '][perms_user]" value="' . $this->pageinfo['perms_user'] . '" />
			<input type="hidden" name="data[pages][' . $this->id . '][perms_group]" value="' . $this->pageinfo['perms_group'] . '" />
			<input type="hidden" name="data[pages][' . $this->id . '][perms_everybody]" value="' . $this->pageinfo['perms_everybody'] . '" />
			' . $this->getRecursiveSelect($this->id, $this->perms_clause) . '
			<input type="submit" name="submit" value="' . $LANG->getLL('Save', 1) . '" />' . '<input type="submit" value="' . $LANG->getLL('Abort', 1) . '" onclick="' . htmlspecialchars('jumpToUrl(\'index.php?id=' . $this->id . '\'); return false;') . '" />
			<input type="hidden" name="redirect" value="' . htmlspecialchars(TYPO3_MOD_PATH . 'index.php?mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . intval($this->return_id) . '&lastEdited=' . $this->id) . '" />
		';
        // Adding section with the permission setting matrix:
        $this->content .= $this->doc->divider(5);
        $this->content .= $this->doc->section($LANG->getLL('permissions') . ':', $code);
        // CSH for permissions setting
        $this->content .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'perm_module_setting', $GLOBALS['BACK_PATH'], '<br /><br />');
        // Adding help text:
        if ($BE_USER->uc['helpText']) {
            $this->content .= $this->doc->divider(20);
            $legendText = '<strong>' . $LANG->getLL('1', 1) . '</strong>: ' . $LANG->getLL('1_t', 1);
            $legendText .= '<br /><strong>' . $LANG->getLL('16', 1) . '</strong>: ' . $LANG->getLL('16_t', 1);
            $legendText .= '<br /><strong>' . $LANG->getLL('2', 1) . '</strong>: ' . $LANG->getLL('2_t', 1);
            $legendText .= '<br /><strong>' . $LANG->getLL('4', 1) . '</strong>: ' . $LANG->getLL('4_t', 1);
            $legendText .= '<br /><strong>' . $LANG->getLL('8', 1) . '</strong>: ' . $LANG->getLL('8_t', 1);
            $code = $legendText . '<br /><br />' . $LANG->getLL('def', 1);
            $this->content .= $this->doc->section($LANG->getLL('Legend', 1) . ':', $code);
        }
    }
    /**
     * Creating form for editing the permissions	($this->edit = true)
     * (Adding content to internal content variable)
     *
     * @return	void
     */
    function doEdit()
    {
        global $BE_USER, $LANG;
        // get ACL configuration
        $beAclConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['be_acl']);
        if ($beAclConfig['disableOldPermissionSystem']) {
            $disableOldPermissionSystem = 1;
        } else {
            $disableOldPermissionSystem = 0;
        }
        $LANG->includeLLFile('EXT:be_acl/res/locallang_perm.php');
        // Get usernames and groupnames
        $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
        $groupArray = array_keys($be_group_Array);
        $be_user_Array = t3lib_BEfunc::getUserNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $be_user_Array = t3lib_BEfunc::blindUserNames($be_user_Array, $groupArray, 1);
        }
        $be_group_Array_o = $be_group_Array = t3lib_BEfunc::getGroupNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $be_group_Array = t3lib_BEfunc::blindGroupNames($be_group_Array_o, $groupArray, 1);
        }
        $firstGroup = $groupArray[0] ? $be_group_Array[$groupArray[0]] : '';
        // data of the first group, the user is member of
        // set JavaScript
        $subPagesData = '';
        // generate list if record is available on subpages, if yes, enter the id
        $this->content .= '<script src="../../../' . t3lib_extMgm::extRelPath('be_acl') . 'res/acl.js" type="text/javascript">
			' . $subPagesData . '
		</script>';
        // Owner selector:
        $options = '';
        $userset = 0;
        // flag: is set if the page-userid equals one from the user-list
        foreach ($be_user_Array as $uid => $row) {
            if ($uid == $this->pageinfo['perms_userid']) {
                $userset = 1;
                $selected = ' selected="selected"';
            } else {
                $selected = '';
            }
            $options .= '
				<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['username']) . '</option>';
        }
        $options = '
				<option value="0"></option>' . $options;
        // hide selector if not needed
        if ($disableOldPermissionSystem) {
            $hidden = ' style="display:none;" ';
        } else {
            $hidden = '';
        }
        $selector = '
			<select name="data[pages][' . $this->id . '][perms_userid]" ' . $hidden . '>
				' . $options . '
			</select>';
        if ($disableOldPermissionSystem) {
            $this->content .= $selector;
        } else {
            $this->content .= $this->doc->section($LANG->getLL('Owner') . ':', $selector);
        }
        // Group selector:
        $options = '';
        $userset = 0;
        foreach ($be_group_Array as $uid => $row) {
            if ($uid == $this->pageinfo['perms_groupid']) {
                $userset = 1;
                $selected = ' selected="selected"';
            } else {
                $selected = '';
            }
            $options .= '
				<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['title']) . '</option>';
        }
        if (!$userset && $this->pageinfo['perms_groupid']) {
            // If the group was not set AND there is a group for the page
            $options = '
				<option value="' . $this->pageinfo['perms_groupid'] . '" selected="selected">' . htmlspecialchars($be_group_Array_o[$this->pageinfo['perms_groupid']]['title']) . '</option>' . $options;
        }
        $options = '
				<option value="0"></option>' . $options;
        $selector = '
			<select name="data[pages][' . $this->id . '][perms_groupid]"  ' . $hidden . '>
				' . $options . '
			</select>';
        if ($disableOldPermissionSystem) {
            $this->content .= $selector;
        } else {
            $this->content .= $this->doc->divider(5);
            $this->content .= $this->doc->section($LANG->getLL('Group') . ':', $selector);
        }
        // Permissions checkbox matrix:
        $code = '
		<input type="hidden" name="pageID" value="' . $this->id . '" />
			<table border="0" cellspacing="2" cellpadding="0" id="typo3-permissionMatrix"><tbody>
				<tr>
					<td></td>
					<td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('1', 1)) . '</td>
					<td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('16', 1)) . '</td>
					<td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('2', 1)) . '</td>
					<td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('4', 1)) . '</td>
					<td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('8', 1)) . '</td>
					<td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('recursiveAcl', 1)) . '</td>
					<td></td>
				</tr>';
        if (!$disableOldPermissionSystem) {
            $code .= '
				<tr>
					<td align="right" class="bgColor2">' . $LANG->getLL('Owner', 1) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_user', 1) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_user', 5) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_user', 2) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_user', 3) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_user', 4) . '</td>
					<td class="bgColor-20"></td>
					<td></td>
				</tr>
				<tr>
					<td align="right" class="bgColor2">' . $LANG->getLL('Group', 1) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_group', 1) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_group', 5) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_group', 2) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_group', 3) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_group', 4) . '</td>
					<td class="bgColor-20"></td>
					<td></td>
				</tr>
				<tr>
					<td align="right" class="bgColor2">' . $LANG->getLL('Everybody', 1) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 1) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 5) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 2) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 3) . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 4) . '</td>
					<td class="bgColor-20"></td>
					<td></td>
				</tr>';
        }
        // ACL CODE
        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_beacl_acl', 'pid=' . intval($this->id));
        while ($result = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
            $acl_prefix = 'data[tx_beacl_acl][' . $result['uid'] . ']';
            $code .= '<tr>
					<td align="right" class="bgColor2"><select name="' . $acl_prefix . '[type]" onChange="updateUserGroup(' . $result['uid'] . ')"><option value="0" ' . ($result['type'] ? '' : 'selected="selected"') . '>User</option><option value="1" ' . ($result['type'] ? 'selected="selected"' : '') . '>Group</option></select><select name="' . $acl_prefix . '[object_id]"></select></td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_acl_' . $result['uid'], 1, 'data[tx_beacl_acl][' . $result['uid'] . '][permissions]') . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_acl_' . $result['uid'], 5, 'data[tx_beacl_acl][' . $result['uid'] . '][permissions]') . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_acl_' . $result['uid'], 2, 'data[tx_beacl_acl][' . $result['uid'] . '][permissions]') . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_acl_' . $result['uid'], 3, 'data[tx_beacl_acl][' . $result['uid'] . '][permissions]') . '</td>
					<td class="bgColor-20">' . $this->printCheckBox('perms_acl_' . $result['uid'], 4, 'data[tx_beacl_acl][' . $result['uid'] . '][permissions]') . '
						<input type="hidden" name="' . $acl_prefix . '[permissions]" value="' . $result['permissions'] . '" />

						<script type="text/javascript">updateUserGroup(' . $result['uid'] . ', ' . $result['object_id'] . ');
						setCheck("check[perms_acl_' . $result['uid'] . ']","data[tx_beacl_acl][' . $result['uid'] . '][permissions]");
						global_currentACLs[global_currentACLs.length] = ' . $result['uid'] . ' ;
						</script>

					</td>
					<td class="bgColor-20">
						<input type="hidden" name="' . $acl_prefix . '[recursive]" value="0" />
						<input type="checkbox" name="' . $acl_prefix . '[recursive]" value="1" ' . ($result['recursive'] ? 'checked="checked"' : '') . ' />
					</td>
					<td><a href="#" onClick="deleteACL(' . $result['uid'] . ')"><img ' . t3lib_iconWorks::skinImg('../../../', 'gfx/garbage.gif') . ' alt="' . $LANG->getLL('delAcl', 1) . '" /></a></td>
				</tr>';
        }
        $code .= '
				</tbody>
			</table>
			<br />
			<span id="insertHiddenFields"></span>
			<img ' . t3lib_iconWorks::skinImg('../../../', 'gfx/garbage.gif') . ' alt="' . $LANG->getLL('delAcl', 1) . '" / id="templateDeleteImage" style="display:none">
			<a href="javascript:addACL()"><img  ' . t3lib_iconWorks::skinImg('../../../', 'gfx/new_el.gif') . ' alt="' . $LANG->getLL('addAcl', 1) . '" />' . $LANG->getLL('addAcl', 1) . '</a><br>

			<input type="hidden" name="data[pages][' . $this->id . '][perms_user]" value="' . $this->pageinfo['perms_user'] . '" />
			<input type="hidden" name="data[pages][' . $this->id . '][perms_group]" value="' . $this->pageinfo['perms_group'] . '" />
			<input type="hidden" name="data[pages][' . $this->id . '][perms_everybody]" value="' . $this->pageinfo['perms_everybody'] . '" />
			' . ($disableOldPermissionSystem ? '' : $this->getRecursiveSelect($this->id, $this->perms_clause)) . '
			<input type="submit" name="submit" value="' . $LANG->getLL('saveAndClose', 1) . '" />' . '<input type="submit" value="' . $LANG->getLL('Abort', 1) . '" onclick="' . htmlspecialchars('jumpToUrl(\'index.php?id=' . $this->id . '\'); return false') . '" />
			<input type="hidden" name="redirect" value="' . htmlspecialchars(TYPO3_MOD_PATH . 'index.php?mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . intval($this->return_id) . '&lastEdited=' . $this->id) . '" />
		';
        if (t3lib_div::int_from_ver(TYPO3_version) >= 4005000) {
            $code .= t3lib_TCEforms::getHiddenTokenField('tceAction');
        }
        // only Typo3 V4.5 or later
        // Adding section with the permission setting matrix:
        $this->content .= $this->doc->divider(5);
        $this->content .= $this->doc->section($LANG->getLL('permissions') . ':', $code);
        // CSH for permissions setting
        $this->content .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'perm_module_setting', $GLOBALS['BACK_PATH'], '<br/><br/>');
        // Adding help text:
        if ($BE_USER->uc['helpText']) {
            $this->content .= $this->doc->divider(20);
            $legendText = '<b>' . $LANG->getLL('1', 1) . '</b>: ' . $LANG->getLL('1_t', 1);
            $legendText .= '<br /><b>' . $LANG->getLL('16', 1) . '</b>: ' . $LANG->getLL('16_t', 1);
            $legendText .= '<br /><b>' . $LANG->getLL('2', 1) . '</b>: ' . $LANG->getLL('2_t', 1);
            $legendText .= '<br /><b>' . $LANG->getLL('4', 1) . '</b>: ' . $LANG->getLL('4_t', 1);
            $legendText .= '<br /><b>' . $LANG->getLL('8', 1) . '</b>: ' . $LANG->getLL('8_t', 1);
            $code = $legendText . '<br /><br />' . $LANG->getLL('def', 1);
            $this->content .= $this->doc->section($LANG->getLL('Legend', 1) . ':', $code);
        }
    }
    /**
     * Rendering the overview of versions in the current workspace
     *
     * @return	string		HTML (table)
     * @see typo3/mod/user/ws/index.php for sister function!
     */
    function displayWorkspaceOverview()
    {
        // Initialize variables:
        $this->showWorkspaceCol = $GLOBALS['BE_USER']->workspace === 0 && $this->MOD_SETTINGS['display'] <= -98;
        // Get usernames and groupnames
        $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
        $groupArray = array_keys($be_group_Array);
        $this->be_user_Array = t3lib_BEfunc::getUserNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array, $groupArray, 1);
        }
        // Initialize Workspace ID and filter-value:
        if ($GLOBALS['BE_USER']->workspace === 0) {
            $wsid = $this->details ? -99 : $this->MOD_SETTINGS['display'];
            // Set wsid to the value from the menu (displaying content of other workspaces)
            $filter = $this->details ? 0 : $this->MOD_SETTINGS['filter'];
        } else {
            $wsid = $GLOBALS['BE_USER']->workspace;
            $filter = 0;
        }
        // Initialize workspace object and request all pending versions:
        $wslibObj = t3lib_div::makeInstance('wslib');
        // Selecting ALL versions belonging to the workspace:
        $versions = $wslibObj->selectVersionsInWorkspace($wsid, $filter, -99, $this->uid);
        // $this->uid is the page id of LIVE record.
        // Traverse versions and build page-display array:
        $pArray = array();
        foreach ($versions as $table => $records) {
            foreach ($records as $rec) {
                $pageIdField = $table === 'pages' ? 't3ver_oid' : 'realpid';
                $this->displayWorkspaceOverview_setInPageArray($pArray, $table, $rec);
            }
        }
        // Make header of overview:
        $tableRows = array();
        if (count($pArray)) {
            $tableRows[] = '
				<tr class="bgColor5 tableheader">
					' . ($this->diffOnly ? '' : '<td nowrap="nowrap" colspan="2">' . $GLOBALS['LANG']->getLL('liveVersion') . '</td>') . '
					<td nowrap="nowrap" colspan="2">' . $GLOBALS['LANG']->getLL('wsVersions') . '</td>
					<td nowrap="nowrap"' . ($this->diffOnly ? ' colspan="2"' : ' colspan="4"') . '>' . $GLOBALS['LANG']->getLL('controls') . '</td>
				</tr>';
            // Add lines from overview:
            $tableRows = array_merge($tableRows, $this->displayWorkspaceOverview_list($pArray));
            $table = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding workspace-overview">' . implode('', $tableRows) . '</table>';
        } else {
            $table = '';
        }
        $linkBack = t3lib_div::_GP('returnUrl') ? '<a href="' . htmlspecialchars(t3lib_div::_GP('returnUrl')) . '" class="typo3-goBack">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-back') . $GLOBALS['LANG']->getLL('goBack', TRUE) . '</a><br /><br />' : '';
        $resetDiffOnly = $this->diffOnly ? '<a href="index.php?id=' . intval($this->id) . '" class="typo3-goBack">' . $GLOBALS['LANG']->getLL('showAllInformation') . '</a><br /><br />' : '';
        $versionSelector = $GLOBALS['BE_USER']->workspace ? $this->doc->getVersionSelector($this->id) : '';
        return $versionSelector . $linkBack . $resetDiffOnly . $table . $this->markupNewOriginals();
    }
 /**
  * Callback function to blind user and group accounts. Used as <code>itemsProcFunc</code> in <code>$TCA</code>.
  *
  * @param	array		$conf	Configuration array. The following elements are set:<ul><li>items - initial set of items (empty in our case)</li><li>config - field config from <code>$TCA</code></li><li>TSconfig - this function name</li><li>table - table name</li><li>row - record row (???)</li><li>field - field name</li></ul>
  * @param	object		$tceforms	<code>t3lib_div::TCEforms</code> object
  * @return	void
  */
 function processUserAndGroups($conf, $tceforms)
 {
     // Get usernames and groupnames
     $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
     $groupArray = array_keys($be_group_Array);
     $be_user_Array = t3lib_BEfunc::getUserNames();
     $be_user_Array = t3lib_BEfunc::blindUserNames($be_user_Array, $groupArray, 1);
     // users
     $title = $GLOBALS['LANG']->sL($GLOBALS['TCA']['be_users']['ctrl']['title']);
     foreach ($be_user_Array as $uid => $user) {
         $conf['items'][] = array($user['username'] . ' (' . $title . ')', 'be_users_' . $user['uid'], t3lib_iconWorks::getIcon('be_users', $user));
     }
     // Process groups only if necessary -- save time!
     if (strstr($conf['config']['mod_ws_allowed'], 'be_groups')) {
         // groups
         $be_group_Array = $be_group_Array_o = t3lib_BEfunc::getGroupNames();
         $be_group_Array = t3lib_BEfunc::blindGroupNames($be_group_Array_o, $groupArray, 1);
         $title = $GLOBALS['LANG']->sL($GLOBALS['TCA']['be_groups']['ctrl']['title']);
         foreach ($be_group_Array as $uid => $group) {
             $conf['items'][] = array($group['title'] . ' (' . $title . ')', 'be_groups_' . $group['uid'], t3lib_iconWorks::getIcon('be_groups', $user));
         }
     }
 }
 /**
  * Initializes several class variables
  *
  * @return	void
  */
 function initVars()
 {
     // Init users
     $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
     $groupArray = array_keys($be_group_Array);
     // Need 'admin' field for t3lib_iconWorks::getIconImage()
     $this->be_user_Array = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,admin,workspace_perms');
     if (!$GLOBALS['BE_USER']->isAdmin()) {
         $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array, $groupArray, 1);
     }
     // If another page module was specified, replace the default Page module with the new one
     $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
     $this->pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
     // Setting publish access permission for workspace:
     $this->publishAccess = $GLOBALS['BE_USER']->workspacePublishAccess($GLOBALS['BE_USER']->workspace);
     // FIXME Should be $this->workspaceId here?
 }
 /**
  * Main function for Workspace Manager module.
  *
  * @return	void
  */
 function main()
 {
     global $LANG, $BE_USER, $BACK_PATH;
     // See if we need to switch workspace
     $changeWorkspace = t3lib_div::_GET('changeWorkspace');
     if ($changeWorkspace != '') {
         $BE_USER->setWorkspace($changeWorkspace);
         $this->content .= $this->doc->wrapScriptTags('top.location.href="' . $BACK_PATH . t3lib_BEfunc::getBackendScript() . '";');
     } else {
         // Starting page:
         $this->content .= $this->doc->header($LANG->getLL('title'));
         $this->content .= $this->doc->spacer(5);
         // Get usernames and groupnames
         $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
         $groupArray = array_keys($be_group_Array);
         // Need 'admin' field for t3lib_iconWorks::getIconImage()
         $this->be_user_Array_full = $this->be_user_Array = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,admin,workspace_perms');
         if (!$GLOBALS['BE_USER']->isAdmin()) {
             $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array, $groupArray, 1);
         }
         // Build top menu:
         $menuItems = array();
         $menuItems[] = array('label' => $LANG->getLL('menuitem_review'), 'content' => $this->moduleContent_publish());
         $menuItems[] = array('label' => $LANG->getLL('menuitem_workspaces'), 'content' => $this->moduleContent_workspaceList());
         // Add hidden fields and create tabs:
         $content = $this->doc->getDynTabMenu($menuItems, 'user_ws');
         $this->content .= $this->doc->section('', $content, 0, 1);
         // Setting up the buttons and markers for docheader
         $docHeaderButtons = $this->getButtons();
         // $markers['CSH'] = $docHeaderButtons['csh'];
     }
     $markers['CONTENT'] = $this->content;
     // Build the <body> for the module
     $this->content = $this->doc->startPage($LANG->getLL('title'));
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
 /**
  * Generate the group selector element
  *
  * @param	Integer		$page: The page id to change the user for
  * @param	Integer		$groupUid: The page group uid
  * @param	String		$username: The username to display
  * @return	String		The html select element
  */
 protected function renderGroupSelector($page, $groupUid, $groupname = '')
 {
     // Get usernames
     $beGroups = t3lib_BEfunc::getListGroupNames('title,uid');
     $beGroupKeys = array_keys($beGroups);
     $beGroupsO = $beGroups = t3lib_BEfunc::getGroupNames();
     if (!$GLOBALS['BE_USER']->isAdmin()) {
         $beGroups = t3lib_BEfunc::blindGroupNames($beGroupsO, $beGroupKeys, 1);
     }
     // Group selector:
     $options = '';
     // flag: is set if the page-groupid equals one from the group-list
     $userset = 0;
     // Loop through the groups
     foreach ($beGroups as $uid => $row) {
         if ($uid == $groupUid) {
             $userset = 1;
             $selected = ' selected="selected"';
         } else {
             $selected = '';
         }
         $options .= '<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['title']) . '</option>';
     }
     // If the group was not set AND there is a group for the page
     if (!$userset && $groupUid) {
         $options = '<option value="' . $groupUid . '" selected="selected">' . htmlspecialchars($beGroupsO[$groupUid]['title']) . '</option>' . $options;
     }
     $elementId = 'g_' . $page;
     $options = '<option value="0"></option>' . $options;
     $selector = '<select name="new_page_group" id="new_page_group">' . $options . '</select>';
     $saveButton = '<a onclick="WebPermissions.changeGroup(' . $page . ', ' . $groupUid . ', \'' . $elementId . '\');" title="Change group">' . t3lib_iconWorks::getSpriteIcon('actions-document-save') . '</a>';
     $cancelButton = '<a onclick="WebPermissions.restoreGroup(' . $page . ', ' . $groupUid . ', \'' . ($groupname == '' ? '<span class=not_set>[not set]</span>' : htmlspecialchars($groupname)) . '\', \'' . $elementId . '\');" title="Cancel">' . t3lib_iconWorks::getSpriteIcon('actions-document-close') . '</a>';
     $ret = $selector . $saveButton . $cancelButton;
     return $ret;
 }