/**
  * Render context sensitive help (CSH) for the given table
  *
  * @param string $table Table name ('_MOD_'+module name). If not set, the current module name will be used
  * @param string $field Field name (CSH locallang main key)
  * @param boolean $iconOnly If set, the full text will never be shown (only icon)
  * @param string $styleAttributes Additional style-attribute content for wrapping table (full text mode only)
  * @return string the rendered CSH icon
  * @see t3lib_BEfunc::cshItem
  */
 public function render($table = NULL, $field = '', $iconOnly = FALSE, $styleAttributes = '')
 {
     if ($table === NULL) {
         $currentRequest = $this->controllerContext->getRequest();
         $moduleName = $currentRequest->getPluginName();
         $table = '_MOD_' . $moduleName;
     }
     $cshButton = t3lib_BEfunc::cshItem($table, $field, $GLOBALS['BACK_PATH'], '', $iconOnly, $styleAttributes);
     return '<div class="docheader-csh">' . $cshButton . '</div>';
 }
    /**
     * MAIN function for page information of localization
     *
     * @return	string		Output HTML for the module.
     */
    function main()
    {
        global $BACK_PATH, $LANG, $SOBE;
        if ($this->pObj->id) {
            $theOutput = '';
            // Depth selector:
            $h_func = t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth'], 'index.php');
            $h_func .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[lang]', $this->pObj->MOD_SETTINGS['lang'], $this->pObj->MOD_MENU['lang'], 'index.php');
            $theOutput .= $h_func;
            // Add CSH:
            $theOutput .= t3lib_BEfunc::cshItem('_MOD_web_info', 'lang', $GLOBALS['BACK_PATH'], '|<br/>');
            // Showing the tree:
            // Initialize starting point of page tree:
            $treeStartingPoint = intval($this->pObj->id);
            $treeStartingRecord = t3lib_BEfunc::getRecordWSOL('pages', $treeStartingPoint);
            $depth = $this->pObj->MOD_SETTINGS['depth'];
            // Initialize tree object:
            $tree = t3lib_div::makeInstance('t3lib_pageTree');
            $tree->init('AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1));
            $tree->addField('l18n_cfg');
            // Creating top icon; the current page
            $HTML = t3lib_iconWorks::getIconImage('pages', $treeStartingRecord, $GLOBALS['BACK_PATH'], 'align="top"');
            $tree->tree[] = array('row' => $treeStartingRecord, 'HTML' => $HTML);
            // Create the tree from starting point:
            if ($depth) {
                $tree->getTree($treeStartingPoint, $depth, '');
            }
            #debug($tree->tree);
            // Add CSS needed:
            $css_content = '
				TABLE#langTable {
					margin-top: 10px;
				}
				TABLE#langTable TR TD {
					padding-left : 2px;
					padding-right : 2px;
					white-space: nowrap;
				}
				TD.c-notvisible { background-color: red; }
				TD.c-visible { background-color: #669966; }
				TD.c-translated { background-color: #A8E95C; }
				TD.c-nottranslated { background-color: #E9CD5C; }
				TD.c-leftLine {border-left: 2px solid black; }
				.bgColor5 { font-weight: bold; }
			';
            $marker = '/*###POSTCSSMARKER###*/';
            $this->pObj->content = str_replace($marker, $css_content . chr(10) . $marker, $this->pObj->content);
            // Render information table:
            $theOutput .= $this->renderL10nTable($tree);
        }
        return $theOutput;
    }
Example #3
0
    /**
     * Showing the permissions in a tree ($this->edit = false)
     * (Adding content to internal content variable)
     *
     * @return	void
     */
    public function notEdit()
    {
        global $BE_USER, $LANG, $BACK_PATH;
        // Get usernames and groupnames: The arrays we get in return contains only 1) users which are members of the groups of the current user, 2) groups that the current user is member of
        $beGroupKeys = $BE_USER->userGroupsUID;
        $beUserArray = t3lib_BEfunc::getUserNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $beUserArray = t3lib_BEfunc::blindUserNames($beUserArray, $beGroupKeys, 0);
        }
        $beGroupArray = t3lib_BEfunc::getGroupNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $beGroupArray = t3lib_BEfunc::blindGroupNames($beGroupArray, $beGroupKeys, 0);
        }
        // Length of strings:
        $tLen = $this->MOD_SETTINGS['mode'] == 'perms' ? 20 : 30;
        // Selector for depth:
        $code .= $LANG->getLL('Depth') . ': ';
        $code .= t3lib_BEfunc::getFuncMenu($this->id, 'SET[depth]', $this->MOD_SETTINGS['depth'], $this->MOD_MENU['depth']);
        $this->content .= $this->doc->section('', $code);
        $this->content .= $this->doc->spacer(5);
        // Initialize tree object:
        $tree = t3lib_div::makeInstance('t3lib_pageTree');
        $tree->init('AND ' . $this->perms_clause);
        $tree->addField('perms_user', 1);
        $tree->addField('perms_group', 1);
        $tree->addField('perms_everybody', 1);
        $tree->addField('perms_userid', 1);
        $tree->addField('perms_groupid', 1);
        $tree->addField('hidden');
        $tree->addField('fe_group');
        $tree->addField('starttime');
        $tree->addField('endtime');
        $tree->addField('editlock');
        // Creating top icon; the current page
        $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pageinfo);
        $tree->tree[] = array('row' => $this->pageinfo, 'HTML' => $HTML);
        // Create the tree from $this->id:
        $tree->getTree($this->id, $this->MOD_SETTINGS['depth'], '');
        // Make header of table:
        $code = '';
        if ($this->MOD_SETTINGS['mode'] == 'perms') {
            $code .= '
				<tr class="t3-row-header">
					<td colspan="2">&nbsp;</td>
					<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td>' . $LANG->getLL('Owner', TRUE) . '</td>
					<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $LANG->getLL('Group', TRUE) . '</td>
					<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $LANG->getLL('Everybody', TRUE) . '</td>
					<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $LANG->getLL('EditLock', TRUE) . '</td>
				</tr>
			';
        } else {
            $code .= '
				<tr class="t3-row-header">
					<td colspan="2">&nbsp;</td>
					<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center" nowrap="nowrap">' . $LANG->getLL('User', TRUE) . ': ' . htmlspecialchars($BE_USER->user['username']) . '</td>
					' . (!$BE_USER->isAdmin() ? '<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td align="center">' . $LANG->getLL('EditLock', TRUE) . '</td>' : '') . '
				</tr>';
        }
        // Traverse tree:
        foreach ($tree->tree as $data) {
            $cells = array();
            $pageId = $data['row']['uid'];
            // Background colors:
            $bgCol = $this->lastEdited == $pageId ? ' class="bgColor-20"' : '';
            $lE_bgCol = $bgCol;
            // User/Group names:
            $userName = $beUserArray[$data['row']['perms_userid']] ? $beUserArray[$data['row']['perms_userid']]['username'] : ($data['row']['perms_userid'] ? $data['row']['perms_userid'] : '');
            if ($data['row']['perms_userid'] && !$beUserArray[$data['row']['perms_userid']]) {
                $userName = SC_mod_web_perm_ajax::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($userName, 20)), false);
            } else {
                $userName = SC_mod_web_perm_ajax::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($userName, 20)));
            }
            $groupName = $beGroupArray[$data['row']['perms_groupid']] ? $beGroupArray[$data['row']['perms_groupid']]['title'] : ($data['row']['perms_groupid'] ? $data['row']['perms_groupid'] : '');
            if ($data['row']['perms_groupid'] && !$beGroupArray[$data['row']['perms_groupid']]) {
                $groupName = SC_mod_web_perm_ajax::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($groupName, 20)), false);
            } else {
                $groupName = SC_mod_web_perm_ajax::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($groupName, 20)));
            }
            // Seeing if editing of permissions are allowed for that page:
            $editPermsAllowed = $data['row']['perms_userid'] == $BE_USER->user['uid'] || $BE_USER->isAdmin();
            // First column:
            $cellAttrib = $data['row']['_CSSCLASS'] ? ' class="' . $data['row']['_CSSCLASS'] . '"' : '';
            $cells[] = '
					<td align="left" nowrap="nowrap"' . ($cellAttrib ? $cellAttrib : $bgCol) . '>' . $data['HTML'] . htmlspecialchars(t3lib_div::fixed_lgd_cs($data['row']['title'], $tLen)) . '&nbsp;</td>';
            // "Edit permissions" -icon
            if ($editPermsAllowed && $pageId) {
                $aHref = 'index.php?mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . ($data['row']['_ORIG_uid'] ? $data['row']['_ORIG_uid'] : $pageId) . '&return_id=' . $this->id . '&edit=1';
                $cells[] = '
					<td' . $bgCol . '><a href="' . htmlspecialchars($aHref) . '" title="' . $LANG->getLL('ch_permissions', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a></td>';
            } else {
                $cells[] = '
					<td' . $bgCol . '></td>';
            }
            // Rest of columns (depending on mode)
            if ($this->MOD_SETTINGS['mode'] == 'perms') {
                $cells[] = '
					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? SC_mod_web_perm_ajax::renderPermissions($data['row']['perms_user'], $pageId, 'user') . ' ' . $userName : '') . '</td>

					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? SC_mod_web_perm_ajax::renderPermissions($data['row']['perms_group'], $pageId, 'group') . ' ' . $groupName : '') . '</td>

					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? ' ' . SC_mod_web_perm_ajax::renderPermissions($data['row']['perms_everybody'], $pageId, 'everybody') : '') . '</td>

					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($data['row']['editlock'] ? '<span id="el_' . $pageId . '" class="editlock"><a class="editlock" onclick="WebPermissions.toggleEditLock(\'' . $pageId . '\', \'1\');" title="' . $LANG->getLL('EditLock_descr', 1) . '">' . t3lib_iconWorks::getSpriteIcon('status-warning-lock') . '</a></span>' : ($pageId === 0 ? '' : '<span id="el_' . $pageId . '" class="editlock"><a class="editlock" onclick="WebPermissions.toggleEditLock(\'' . $pageId . '\', \'0\');" title="Enable the &raquo;Admin-only&laquo; edit lock for this page">[+]</a></span>')) . '</td>
				';
            } else {
                $cells[] = '
					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>';
                $bgCol = $BE_USER->user['uid'] == $data['row']['perms_userid'] ? ' class="bgColor-20"' : $lE_bgCol;
                // FIXME $owner undefined
                $cells[] = '
					<td' . $bgCol . ' nowrap="nowrap" align="center">' . ($pageId ? $owner . SC_mod_web_perm_ajax::renderPermissions($BE_USER->calcPerms($data['row']), $pageId, 'user') : '') . '</td>
					' . (!$BE_USER->isAdmin() ? '
					<td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>
					<td' . $bgCol . ' nowrap="nowrap">' . ($data['row']['editlock'] ? t3lib_iconWorks::getSpriteIcon('status-warning-lock', array('title' => $LANG->getLL('EditLock_descr', TRUE))) : '') . '</td>
					' : '');
                $bgCol = $lE_bgCol;
            }
            // Compile table row:
            $code .= '
				<tr>
					' . implode('
					', $cells) . '
				</tr>';
        }
        // Wrap rows in table tags:
        $code = '<table border="0" cellspacing="0" cellpadding="0" id="typo3-permissionList">' . $code . '</table>';
        // Adding the content as a section:
        $this->content .= $this->doc->section('', $code);
        // CSH for permissions setting
        $this->content .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'perm_module', $GLOBALS['BACK_PATH'], '<br />|');
        // Creating legend table:
        $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 = '<table border="0" id="typo3-legendTable">
			<tr>
				<td valign="top">
					<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/legend.gif', 'width="86" height="75"') . ' alt="" />
				</td>
				<td valign="top" nowrap="nowrap">' . $legendText . '</td>
			</tr>
		</table>';
        $code .= '<div id="perm-legend">' . $LANG->getLL('def', 1);
        $code .= '<br /><br />' . t3lib_iconWorks::getSpriteIcon('status-status-permission-granted') . ': ' . $LANG->getLL('A_Granted', 1);
        $code .= '<br />' . t3lib_iconWorks::getSpriteIcon('status-status-permission-denied') . ': ' . $LANG->getLL('A_Denied', 1);
        $code .= '</div>';
        // Adding section with legend code:
        $this->content .= $this->doc->spacer(20);
        $this->content .= $this->doc->section($LANG->getLL('Legend') . ':', $code, 0, 1);
    }
Example #4
0
	/**
	 * Gets the buttons that shall be rendered in the docHeader.
	 *
	 * @return	array		Available buttons for the docHeader
	 */
	protected function getDocHeaderButtons() {
		$buttons = array(
			'csh'      => t3lib_BEfunc::cshItem('_MOD_web_txtemplavoilaM2', '', $this->backPath),
			'shortcut' => $this->getShortcutButton(),
		);
		return $buttons;
	}
 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return	array	all available buttons as an assoc. array
  */
 protected function getButtons()
 {
     $buttons = array('csh' => '', 'refresh' => '');
     // Refresh
     $buttons['refresh'] = '<a href="' . htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')) . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-refresh') . '</a>';
     // CSH
     $buttons['csh'] = str_replace('typo3-csh-inline', 'typo3-csh-inline show-right', t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filetree', $GLOBALS['BACK_PATH']));
     return $buttons;
 }
 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return	array	all available buttons as an assoc. array
  */
 protected function getButtons()
 {
     $buttons = array('csh' => '', 'back' => '');
     // CSH
     $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'history_log', $GLOBALS['BACK_PATH'], '', TRUE);
     // Start history object
     $historyObj = t3lib_div::makeInstance('recordHistory');
     if ($historyObj->returnUrl) {
         $buttons['back'] = '<a href="' . htmlspecialchars($historyObj->returnUrl) . '" class="typo3-goBack">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-back') . '</a>';
     }
     return $buttons;
 }
Example #7
0
	/**
	 * Gets the buttons that shall be rendered in the docHeader.
	 *
	 * @return	array		Available buttons for the docHeader
	 */
	protected function getDocHeaderButtons() {
		$buttons = array(
			'csh'		=> t3lib_BEfunc::cshItem('_MOD_web_txtemplavoilaCM1', '', $this->backPath),
			'back'		=> '',
			'shortcut'	=> $this->getShortcutButton(),
		);

			// Back
		if ($this->returnUrl) {
			$backIcon = t3lib_iconWorks::getSpriteIcon('actions-view-go-back');
			$buttons['back'] = '<a href="' . htmlspecialchars(t3lib_div::linkThisUrl($this->returnUrl)) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.goBack', TRUE) . '">' .
								$backIcon .
							   '</a>';
		}
		return $buttons;
	}
Example #8
0
 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return	array	all available buttons as an assoc. array
  */
 protected function getButtons()
 {
     global $LANG, $BACK_PATH;
     $buttons = array('csh' => '', 'back' => '');
     if ($this->page_id) {
         if ((string) $this->table == 'pages') {
             // CSH
             $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'move_el_pages', $GLOBALS['BACK_PATH'], '', TRUE);
         } elseif ((string) $this->table == 'tt_content') {
             // CSH
             $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'move_el_cs', $GLOBALS['BACK_PATH'], '', TRUE);
         }
         if ($this->R_URI) {
             // Back
             $buttons['back'] = '<a href="' . htmlspecialchars($this->R_URI) . '" class="typo3-goBack" title="' . $LANG->getLL('goBack', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-back') . '</a>';
         }
     }
     return $buttons;
 }
 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return	array	all available buttons as an assoc. array
  */
 protected function getButtons()
 {
     global $LANG, $BACK_PATH;
     $buttons = array('csh' => '', 'back' => '');
     if ($this->id && $this->access) {
         // CSH
         $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'new_ce', $GLOBALS['BACK_PATH'], '', TRUE);
         // Back
         if ($this->R_URI) {
             $buttons['back'] = '<a href="' . htmlspecialchars($this->R_URI) . '" class="typo3-goBack" title="' . $LANG->getLL('goBack', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-back') . '</a>';
         }
     }
     return $buttons;
 }
 /**
  * MAIN function for page information display (including hit statistics)
  *
  * @return	string		Output HTML for the module.
  */
 function main()
 {
     global $BACK_PATH, $LANG, $SOBE;
     $dblist = t3lib_div::makeInstance('tx_cms_layout');
     $dblist->descrTable = '_MOD_' . $GLOBALS['MCONF']['name'];
     $dblist->backPath = $BACK_PATH;
     $dblist->thumbs = 0;
     $dblist->script = 'index.php';
     $dblist->showIcon = 0;
     $dblist->setLMargin = 0;
     $dblist->agePrefixes = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears');
     $dblist->pI_showUser = 1;
     $dblist->pI_showStat = 0;
     // PAGES:
     $this->pObj->MOD_SETTINGS['pages_levels'] = $this->pObj->MOD_SETTINGS['depth'];
     // ONLY for the sake of dblist module which uses this value.
     $h_func = t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth'], 'index.php');
     if ($this->pObj->MOD_SETTINGS['function'] == 'tx_cms_webinfo_hits') {
         $h_func .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[stat_type]', $this->pObj->MOD_SETTINGS['stat_type'], $this->pObj->MOD_MENU['stat_type'], 'index.php');
         if ($this->pObj->MOD_SETTINGS['stat_type'] == 1) {
             $dblist->stat_select_field = 'rl0';
         }
         if ($this->pObj->MOD_SETTINGS['stat_type'] == 2) {
             $dblist->stat_select_field = 'rl1';
         }
         // Timespan
         for ($a = 0; $a < 30; $a++) {
             $dblist->stat_codes[] = 'HITS_days:' . -$a;
         }
         $timespan_b = mktime(0, 0, 0);
         $timespan_e = mktime(0, 0, 0) - (30 - 1) * 3600 * 24 + 1;
         $header = '<br />' . sprintf($LANG->getLL('stat_period'), t3lib_BEfunc::date($timespan_b), t3lib_BEfunc::date($timespan_e)) . '<br />';
         //
         $dblist->start($this->pObj->id, 'pages', 0);
         $dblist->pages_noEditColumns = 1;
         $dblist->generateList();
         $theOutput .= $this->pObj->doc->section($LANG->getLL('hits_title'), t3lib_BEfunc::cshItem($dblist->descrTable, 'stat', $GLOBALS['BACK_PATH'], '|<br />') . $h_func . $header . $dblist->HTMLcode, 0, 1);
     } else {
         $h_func .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[pages]', $this->pObj->MOD_SETTINGS['pages'], $this->pObj->MOD_MENU['pages'], 'index.php');
         $dblist->start($this->pObj->id, 'pages', 0);
         $dblist->generateList();
         // CSH
         $theOutput .= $this->pObj->doc->section($LANG->getLL('page_title'), t3lib_BEfunc::cshItem($dblist->descrTable, 'pagetree_overview', $GLOBALS['BACK_PATH'], '|<br />') . $h_func . $dblist->HTMLcode, 0, 1);
         // SYS_NOTES:
         if (t3lib_extMgm::isLoaded('sys_note')) {
             $dblist->start($this->pObj->id, 'sys_note', 0);
             $dblist->generateList();
             if ($dblist->HTMLcode) {
                 $theOutput .= $this->pObj->doc->spacer(10);
                 $theOutput .= $this->pObj->doc->section($LANG->getLL('page_sysnote'), $dblist->HTMLcode, 0, 1);
             }
         }
         // PAGE INFORMATION
         if ($this->pObj->pageinfo['uid']) {
             $theOutput .= $this->pObj->doc->spacer(10);
             $theOutput .= $this->pObj->doc->section($LANG->getLL('pageInformation'), $dblist->getPageInfoBox($this->pObj->pageinfo, $this->pObj->CALC_PERMS & 2), 0, 1);
         }
     }
     return $theOutput;
 }
Example #11
0
 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return	array	all available buttons as an assoc. array
  */
 function getButtons()
 {
     global $TCA, $LANG, $BACK_PATH, $BE_USER;
     $buttons = array('csh' => '', 'shortcut' => '', 'upload' => '', 'new' => '');
     // Add shortcut
     if ($BE_USER->mayMakeShortcut()) {
         $buttons['shortcut'] = $this->doc->makeShortcutIcon('pointer,id,target,table', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
     }
     // FileList Module CSH:
     $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filelist_module', $GLOBALS['BACK_PATH'], '', TRUE);
     // upload button
     $buttons['upload'] = '<a href="' . $BACK_PATH . 'file_upload.php?target=' . rawurlencode($this->id) . '&amp;returnUrl=' . rawurlencode($this->filelist->listURL()) . '" id="button-upload" title="' . $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:cm.upload', 1)) . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-upload') . '</a>';
     $buttons['new'] = '<a href="' . $BACK_PATH . 'file_newfolder.php?target=' . rawurlencode($this->id) . '&amp;returnUrl=' . rawurlencode($this->filelist->listURL()) . '" title="' . $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:cm.new', 1)) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-new') . '</a>';
     return $buttons;
 }
    /**
     * Renders the HTML code for a selectorbox for selecting a new translation language for the current
     * page (create a new "Alternative Page Header".
     *
     * @return	mixed		HTML code for the selectorbox or FALSE if no new translation can be created.
     * @access	protected
     */
    function sidebar_renderItem_renderNewTranslationSelectorbox()
    {
        global $LANG, $BE_USER;
        if (!$GLOBALS['BE_USER']->isPSet($this->pObj->calcPerms, 'pages', 'edit')) {
            return false;
        }
        $newLanguagesArr = $this->pObj->getAvailableLanguages(0, true, false);
        if (count($newLanguagesArr) < 1) {
            return FALSE;
        }
        $translatedLanguagesArr = $this->pObj->getAvailableLanguages($this->pObj->id);
        $optionsArr = array('<option value=""></option>');
        foreach ($newLanguagesArr as $language) {
            if ($BE_USER->checkLanguageAccess($language['uid']) && !isset($translatedLanguagesArr[$language['uid']])) {
                $flag = tx_templavoila_icons::getFlagIconFileForLanguage($language['flagIcon']);
                $style = isset($language['flagIcon']) ? 'background-image: url(' . $flag . '); background-repeat: no-repeat; padding-top: 0px; padding-left: 22px;' : '';
                $optionsArr[] = '<option style="' . $style . '" name="createNewPageTranslation" value="' . $language['uid'] . '">' . htmlspecialchars($language['title']) . '</option>';
            }
        }
        if (count($optionsArr) > 1) {
            $linkParam = $this->pObj->rootElementTable == 'pages' ? '&doktype=' . $this->pObj->rootElementRecord['doktype'] : '';
            $link = 'index.php?' . $this->pObj->link_getParameters() . '&createNewPageTranslation=\'+this.options[this.selectedIndex].value+\'&pid=' . $this->pObj->id . $linkParam;
            $output = '
				<tr class="bgColor4">
					<td width="20">
						' . t3lib_BEfunc::cshItem('_MOD_web_txtemplavoilaM1', 'createnewtranslation', $this->doc->backPath) . '
					</td><td width="200" style="vertical-align:middle;">
						' . $LANG->getLL('createnewtranslation', 1) . ':
					</td>
					<td style="vertical-align:middle;"><select onChange="document.location=\'' . htmlspecialchars($link) . '\'">' . implode('', $optionsArr) . '</select></td>
				</tr>
			';
        }
        return $output;
    }
Example #13
0
    /**
     * Rendering the outline display of the page structure
     *
     * @param	array		$contentTreeArr: DataStructure info array (the whole tree)
     * @return	string		HTML
     */
    function render_outline($contentTreeArr)
    {
        global $LANG;
        // Load possible website languages:
        $this->translatedLanguagesArr_isoCodes = array();
        foreach ($this->translatedLanguagesArr as $langInfo) {
            if ($langInfo['ISOcode']) {
                $this->translatedLanguagesArr_isoCodes['all_lKeys'][] = 'l' . $langInfo['ISOcode'];
                $this->translatedLanguagesArr_isoCodes['all_vKeys'][] = 'v' . $langInfo['ISOcode'];
            }
        }
        // Rendering the entries:
        $entries = array();
        $this->render_outline_element($contentTreeArr, $entries);
        // Header of table:
        $output = '';
        $output .= '<tr class="bgColor5 tableheader">
				<td class="nobr">' . $LANG->getLL('outline_header_title', 1) . '</td>
				<td class="nobr">' . $LANG->getLL('outline_header_controls', 1) . '</td>
				<td class="nobr">' . $LANG->getLL('outline_header_status', 1) . '</td>
				<td class="nobr">' . $LANG->getLL('outline_header_element', 1) . '</td>
			</tr>';
        // Render all entries:
        $xmlCleanCandidates = FALSE;
        foreach ($entries as $entry) {
            // Create indentation code:
            $indent = '';
            for ($a = 0; $a < $entry['indentLevel']; $a++) {
                $indent .= '&nbsp;&nbsp;&nbsp;&nbsp;';
            }
            // Create status for FlexForm XML:
            // WARNING: Also this section contains cleaning of XML which is sort of mixing functionality but a quick and easy solution for now.
            // @Robert: How would you like this implementation better? Please advice and I will change it according to your wish!
            $status = '';
            if ($entry['table'] && $entry['uid']) {
                $flexObj = t3lib_div::makeInstance('t3lib_flexformtools');
                $recRow = t3lib_BEfunc::getRecordWSOL($entry['table'], $entry['uid']);
                if ($recRow['tx_templavoila_flex']) {
                    // Clean XML:
                    $newXML = $flexObj->cleanFlexFormXML($entry['table'], 'tx_templavoila_flex', $recRow);
                    // If the clean-all command is sent AND there is a difference in current/clean XML, save the clean:
                    if (t3lib_div::_POST('_CLEAN_XML_ALL') && md5($recRow['tx_templavoila_flex']) != md5($newXML)) {
                        $dataArr = array();
                        $dataArr[$entry['table']][$entry['uid']]['tx_templavoila_flex'] = $newXML;
                        // Init TCEmain object and store:
                        $tce = t3lib_div::makeInstance('t3lib_TCEmain');
                        $tce->stripslashes_values = 0;
                        $tce->start($dataArr, array());
                        $tce->process_datamap();
                        // Re-fetch record:
                        $recRow = t3lib_BEfunc::getRecordWSOL($entry['table'], $entry['uid']);
                    }
                    // Render status:
                    $xmlUrl = '../cm2/index.php?viewRec[table]=' . $entry['table'] . '&viewRec[uid]=' . $entry['uid'] . '&viewRec[field_flex]=tx_templavoila_flex';
                    if (md5($recRow['tx_templavoila_flex']) != md5($newXML)) {
                        $status = $this->doc->icons(1) . '<a href="' . htmlspecialchars($xmlUrl) . '">' . $LANG->getLL('outline_status_dirty', 1) . '</a><br/>';
                        $xmlCleanCandidates = TRUE;
                    } else {
                        $status = $this->doc->icons(-1) . '<a href="' . htmlspecialchars($xmlUrl) . '">' . $LANG->getLL('outline_status_clean', 1) . '</a><br/>';
                    }
                }
            }
            // Compile table row:
            $class = ($entry['isNewVersion'] ? 'bgColor5' : 'bgColor4') . ' ' . $entry['elementTitlebarClass'];
            $output .= '<tr class="' . $class . '">
					<td class="nobr">' . $indent . $entry['icon'] . $entry['flag'] . $entry['title'] . '</td>
					<td class="nobr">' . $entry['controls'] . '</td>
					<td>' . $status . $entry['warnings'] . ($entry['isNewVersion'] ? $this->doc->icons(1) . 'New version!' : '') . '</td>
					<td class="nobr">' . htmlspecialchars($entry['id'] ? $entry['id'] : $entry['table'] . ':' . $entry['uid']) . '</td>
				</tr>';
        }
        $output = '<table border="0" cellpadding="1" cellspacing="1" class="tpm-outline-table">' . $output . '</table>';
        // Show link for cleaning all XML structures:
        if ($xmlCleanCandidates) {
            $output .= '<br/>
				' . t3lib_BEfunc::cshItem('_MOD_web_txtemplavoilaM1', 'outline_status_cleanall', $this->doc->backPath) . '
				<input type="submit" value="' . $LANG->getLL('outline_status_cleanAll', 1) . '" name="_CLEAN_XML_ALL" /><br/><br/>
			';
        }
        return $output;
    }
Example #14
0
 /**
  * Wrapper function for context sensitive help - for downwards compatibility with TYPO3 prior 3.7.x
  *
  * @param	string		Table name ('_MOD_'+module name)
  * @param	string		Field name (CSH locallang main key)
  * @param	string		Back path
  * @param	string		Wrap code for icon-mode, splitted by "|". Not used for full-text mode.
  * @param	boolean		If set, the full text will never be shown (only icon). Useful for places where it will break the page if the table with full text is shown.
  * @param	string		Additional style-attribute content for wrapping table (full text mode only)
  * @return	string		HTML content for help text
  */
 function cshItem($table, $field, $BACK_PATH, $wrap = '', $onlyIconMode = FALSE, $styleAttrib = '')
 {
     if (is_callable(array('t3lib_BEfunc', 'cshItem'))) {
         return t3lib_BEfunc::cshItem($table, $field, $BACK_PATH, $wrap, $onlyIconMode, $styleAttrib);
     }
     return '';
 }
    /**
     * Main function creating the content for the module.
     *
     * @return	string		HTML content for the module, actually a "section" made through the parent object in $this->pObj
     */
    function main()
    {
        global $SOBE, $LANG;
        $theCode = '';
        $m_perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(8);
        // create new pages here?
        $pRec = t3lib_BEfunc::getRecord('pages', $this->pObj->id, 'uid', ' AND ' . $m_perms_clause);
        $sys_pages = t3lib_div::makeInstance('t3lib_pageSelect');
        $menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0);
        if (is_array($pRec)) {
            $data = t3lib_div::_GP('data');
            if (is_array($data['pages'])) {
                if (t3lib_div::_GP('createInListEnd')) {
                    $endI = end($menuItems);
                    $thePid = -intval($endI['uid']);
                    if (!$thePid) {
                        $thePid = $this->pObj->id;
                    }
                } else {
                    $thePid = $this->pObj->id;
                }
                $firstRecord = true;
                foreach ($data['pages'] as $identifier => $dat) {
                    if (!trim($dat['title'])) {
                        unset($data['pages'][$identifier]);
                    } else {
                        $data['pages'][$identifier]['hidden'] = t3lib_div::_GP('hidePages') ? 1 : 0;
                        if ($firstRecord) {
                            $firstRecord = false;
                            $data['pages'][$identifier]['pid'] = $thePid;
                        } else {
                            $data['pages'][$identifier]['pid'] = '-' . $previousIdentifier;
                        }
                        $previousIdentifier = $identifier;
                    }
                }
                if (count($data['pages'])) {
                    reset($data);
                    $tce = t3lib_div::makeInstance('t3lib_TCEmain');
                    $tce->stripslashes_values = 0;
                    // set default TCA values specific for the user
                    $TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults');
                    if (is_array($TCAdefaultOverride)) {
                        $tce->setDefaultsFromUserTS($TCAdefaultOverride);
                    }
                    $tce->start($data, array());
                    $tce->process_datamap();
                    t3lib_BEfunc::setUpdateSignal('updatePageTree');
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_create'));
                } else {
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', $GLOBALS['LANG']->getLL('wiz_newPages_noCreate'), t3lib_FlashMessage::ERROR);
                }
                $theCode .= $flashMessage->render();
                // Display result:
                $menuItems = $sys_pages->getMenu($this->pObj->id, '*', 'sorting', '', 0);
                $lines = array();
                foreach ($menuItems as $rec) {
                    t3lib_BEfunc::workspaceOL('pages', $rec);
                    if (is_array($rec)) {
                        $lines[] = '<nobr>' . t3lib_iconWorks::getSpriteIconForRecord('pages', $rec, array('title' => t3lib_BEfunc::titleAttribForPages($rec, '', FALSE))) . htmlspecialchars(t3lib_div::fixed_lgd_cs($rec['title'], $GLOBALS['BE_USER']->uc['titleLen'])) . '</nobr>';
                    }
                }
                $theCode .= '<h4>' . $LANG->getLL('wiz_newPages_currentMenu') . '</h4>' . implode('<br />', $lines);
            } else {
                // Create loremIpsum code:
                if (t3lib_extMgm::isLoaded('lorem_ipsum')) {
                    $loremIpsumObj = t3lib_div::getUserObj('EXT:lorem_ipsum/class.tx_loremipsum_wiz.php:tx_loremipsum_wiz');
                }
                // Display create form
                $lines = array();
                for ($a = 0; $a < 9; $a++) {
                    $lines[] = '<label for="page_new_' . $a . '"> ' . $LANG->getLL('wiz_newPages_page') . ' ' . ($a + 1) . ':&nbsp;</label><input type="text" id="page_new_' . $a . '" name="data[pages][NEW' . $a . '][title]"' . $this->pObj->doc->formWidth(35) . ' />' . (is_object($loremIpsumObj) ? '<a href="#" onclick="' . htmlspecialchars($loremIpsumObj->getHeaderTitleJS('document.forms[0][\'data[pages][NEW' . $a . '][title]\'].value', 'title')) . '">' . $loremIpsumObj->getIcon('', $this->pObj->doc->backPath) . '</a>' : '');
                }
                $theCode .= '<h4>' . $LANG->getLL('wiz_newPages') . ':</h4>' . implode('<br />', $lines) . '<br /><br />
				<input type="checkbox" name="createInListEnd" id="createInListEnd" value="1" /> <label for="createInListEnd">' . $LANG->getLL('wiz_newPages_listEnd') . '</label><br />
				<input type="checkbox" name="hidePages" id="hidePages" value="1" /> <label for="hidePages">' . $LANG->getLL('wiz_newPages_hidePages') . '</label><br /><br />
				<input type="submit" name="create" value="' . $LANG->getLL('wiz_newPages_lCreate') . '" onclick="return confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('wiz_newPages_lCreate_msg1')) . ')" />&nbsp;<input type="reset" value="' . $LANG->getLL('wiz_newPages_lReset') . '" /><br />';
            }
        } else {
            $theCode .= $GLOBALS['TBE_TEMPLATE']->rfw($LANG->getLL('wiz_newPages_errorMsg1'));
        }
        // CSH
        $theCode .= t3lib_BEfunc::cshItem('_MOD_web_func', 'tx_wizardcrpages', $GLOBALS['BACK_PATH'], '<br />|');
        $out = $this->pObj->doc->section($LANG->getLL('wiz_crMany'), $theCode, 0, 1);
        return $out;
    }
Example #16
0
 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return	array	all available buttons as an assoc. array
  */
 protected function getButtons()
 {
     global $TCA, $LANG;
     $buttons = array('save' => '', 'save_view' => '', 'save_new' => '', 'save_close' => '', 'close' => '', 'delete' => '', 'undo' => '', 'history' => '', 'columns_only' => '', 'csh' => '', 'translation_save' => '', 'translation_saveclear' => '');
     // Render SAVE type buttons:
     // The action of each button is decided by its name attribute. (See doProcessData())
     if (!$this->errorC && !$TCA[$this->firstEl['table']]['ctrl']['readOnly']) {
         // SAVE button:
         $buttons['save'] = t3lib_iconWorks::getSpriteIcon('actions-document-save', array('html' => '<input type="image" name="_savedok" class="c-inputButton" src="clear.gif" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" />'));
         // SAVE / VIEW button:
         if ($this->viewId && !$this->noView && t3lib_extMgm::isLoaded('cms') && $this->getNewIconMode($this->firstEl['table'], 'saveDocView')) {
             $buttons['save_view'] = t3lib_iconWorks::getSpriteIcon('actions-document-save-view', array('html' => '<input type="image" class="c-inputButton" name="_savedokview" src="clear.gif" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow', 1) . '" />'));
         }
         // SAVE / NEW button:
         if (count($this->elementsData) == 1 && $this->getNewIconMode($this->firstEl['table'])) {
             $buttons['save_new'] = t3lib_iconWorks::getSpriteIcon('actions-document-save-new', array('html' => '<input type="image" class="c-inputButton" name="_savedoknew" src="clear.gif" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveNewDoc', 1) . '" />'));
         }
         // SAVE / CLOSE
         $buttons['save_close'] = t3lib_iconWorks::getSpriteIcon('actions-document-save-close', array('html' => '<input type="image" class="c-inputButton" name="_saveandclosedok" src="clear.gif" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc', 1) . '" />'));
         // FINISH TRANSLATION / SAVE / CLOSE
         if ($GLOBALS['TYPO3_CONF_VARS']['BE']['explicitConfirmationOfTranslation']) {
             $buttons['translation_save'] = '<input type="image" class="c-inputButton" name="_translation_savedok" src="' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/translationsavedok.gif', '', 1) . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.translationSaveDoc', 1) . '" />';
             $buttons['translation_saveclear'] = '<input type="image" class="c-inputButton" name="_translation_savedokclear" src="' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/translationsavedok_clear.gif', '', 1) . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.translationSaveDocClear', 1) . '" />';
         }
     }
     // CLOSE button:
     $buttons['close'] = '<a href="#" onclick="document.editform.closeDoc.value=1; document.editform.submit(); return false;" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-close') . '</a>';
     // DELETE + UNDO buttons:
     if (!$this->errorC && !$TCA[$this->firstEl['table']]['ctrl']['readOnly'] && count($this->elementsData) == 1) {
         if ($this->firstEl['cmd'] != 'new' && t3lib_div::testInt($this->firstEl['uid'])) {
             // Delete:
             if ($this->firstEl['deleteAccess'] && !$TCA[$this->firstEl['table']]['ctrl']['readOnly'] && !$this->getNewIconMode($this->firstEl['table'], 'disableDelete')) {
                 $aOnClick = 'return deleteRecord(\'' . $this->firstEl['table'] . '\',\'' . $this->firstEl['uid'] . '\',unescape(\'' . rawurlencode($this->retUrl) . '\'));';
                 $buttons['delete'] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $LANG->getLL('deleteItem', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete') . '</a>';
             }
             // Undo:
             $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->firstEl['table'], 'sys_history') . ' AND recuid=' . intval($this->firstEl['uid']), '', 'tstamp DESC', '1');
             if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
                 $aOnClick = 'window.location.href=\'show_rechis.php?element=' . rawurlencode($this->firstEl['table'] . ':' . $this->firstEl['uid']) . '&revert=ALL_FIELDS&sumUp=-1&returnUrl=' . rawurlencode($this->R_URI) . '\'; return false;';
                 $buttons['undo'] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"' . ' title="' . htmlspecialchars(sprintf($LANG->getLL('undoLastChange'), t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $undoButtonR['tstamp'], $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-undo') . '</a>';
             }
             if ($this->getNewIconMode($this->firstEl['table'], 'showHistory')) {
                 $aOnClick = 'window.location.href=\'show_rechis.php?element=' . rawurlencode($this->firstEl['table'] . ':' . $this->firstEl['uid']) . '&returnUrl=' . rawurlencode($this->R_URI) . '\'; return false;';
                 $buttons['history'] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-history-open') . '</a>';
             }
             // If only SOME fields are shown in the form, this will link the user to the FULL form:
             if ($this->columnsOnly) {
                 $buttons['columns_only'] = '<a href="' . htmlspecialchars($this->R_URI . '&columnsOnly=') . '" title="' . $LANG->getLL('editWholeRecord', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>';
             }
         }
     }
     // add the CSH icon
     $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms', $GLOBALS['BACK_PATH'], '', TRUE);
     $buttons['shortcut'] = $this->shortCutLink();
     $buttons['open_in_new_window'] = $this->openInNewWindowLink();
     return $buttons;
 }
Example #17
0
 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return	array	all available buttons as an assoc. array
  */
 protected function getButtons()
 {
     $buttons = array();
     // CSH
     $buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']);
     // SAVE button
     $buttons['save'] = '<input type="image" class="c-inputButton" name="submit" value="Update"' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/savedok.gif', '') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" />';
     // Shortcut
     if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
         $buttons['shortcut'] = $this->doc->makeShortcutIcon('', 'function', $this->MCONF['name']);
     }
     return $buttons;
 }
    /**
     * 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);
        }
    }
Example #19
0
 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return	array	all available buttons as an assoc. array
  */
 protected function getButtons()
 {
     $buttons = array('csh' => '', 'save' => '', 'shortcut' => '');
     $buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_user_setup', '', $GLOBALS['BACK_PATH'], '|', true);
     if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
         $buttons['shortcut'] = $this->doc->makeShortcutIcon('', '', $this->MCONF['name']);
     }
     return $buttons;
 }
    /**
     * Main function, rendering the content of the rename form
     *
     * @return	void
     */
    function main()
    {
        //TODO remove global, change $LANG into $GLOBALS['LANG'], change locallang*.php to locallang*.xml
        global $LANG;
        // Make page header:
        $this->content = $this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_rename.php.pagetitle'));
        $pageContent = $this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_rename.php.pagetitle'));
        $pageContent .= $this->doc->spacer(5);
        $pageContent .= $this->doc->divider(5);
        $code = '<form action="tce_file.php" method="post" name="editform">';
        // Making the formfields for renaming:
        $code .= '

			<div id="c-rename">
				<input type="text" name="file[rename][0][data]" value="' . htmlspecialchars(basename($this->shortPath)) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' />
				<input type="hidden" name="file[rename][0][target]" value="' . htmlspecialchars($this->target) . '" />
			</div>
		';
        // Making submit button:
        $code .= '
			<div id="c-submit">
				<input type="submit" value="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:file_rename.php.submit', 1) . '" />
				<input type="submit" value="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.cancel', 1) . '" onclick="backToList(); return false;" />
				<input type="hidden" name="redirect" value="' . htmlspecialchars($this->returnUrl) . '" />
			</div>
		';
        $code .= '</form>';
        // Add the HTML as a section:
        $pageContent .= $code;
        $docHeaderButtons = array();
        $docHeaderButtons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_rename', $GLOBALS['BACK_PATH']);
        // Add the HTML as a section:
        $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $pageContent, 'PATH' => $this->title);
        $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
Example #21
0
 /**
  * Gets the buttons that shall be rendered in the docHeader.
  *
  * @return	array		Available buttons for the docHeader
  */
 protected function getDocHeaderButtons()
 {
     $buttons = array('csh' => t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']), 'shortcut' => $this->getShortcutButton(), 'save' => '');
     // SAVE button
     $buttons['save'] = '';
     //<input type="image" class="c-inputButton" name="submit" value="Update"' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/savedok.gif', '') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" />';
     return $buttons;
 }
Example #22
0
    /**
     * Main content generated
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $TYPO3_CONF_VARS, $TBE_TEMPLATE;
        $TBE_TEMPLATE->divClass = 'vertical-menu';
        $TBE_TEMPLATE->bodyTagAdditions = 'onload="top.restoreHighlightedModuleMenuItem()"';
        $this->content .= $TBE_TEMPLATE->startPage('Vertical Backend Menu');
        $backPath = $GLOBALS['BACK_PATH'];
        // Printing the menu
        $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
        $this->content .= $alt_menuObj->topMenu($this->loadModules->modules);
        // clear cache commands for Admins and allowed users
        if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages') || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')) {
            //  && $BE_USER->workspace===0 NOT used anyway because under a workspace developers might still like to clear cache!
            $functionsArray = $alt_menuObj->adminFunctions($backPath);
            $this->content .= '

<!--
  Menu with admin functions: Clearing cache:
-->
<div id="typo3-alt-menu-php-adminFunc">';
            // Table with those admin functions
            $this->content .= '
				<table border="0" cellpadding="0" cellspacing="1" width="100%" id="typo3-adminmenu">';
            // Header: Admin functions
            $this->content .= '
					<tr class="c-mainitem">
						<td colspan="2"><span class="c-label"><strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.adminFunctions', 1) . '</strong>&nbsp;</span><span class="c-iconCollapse"></span></td>
					</tr>';
            $rows = array();
            foreach ($functionsArray as $functionsArraySetup) {
                if ($functionsArraySetup['id'] == 'all' && ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')) || $functionsArraySetup['id'] == 'temp_CACHED' && $GLOBALS['BE_USER']->isAdmin()) {
                    $rows[] = '
						<tr class="c-subitem">
							<td valign="top" align="center" class="icon">' . $functionsArraySetup['icon'] . '</td>
							<td><a href="' . htmlspecialchars($functionsArraySetup['href']) . '">' . htmlspecialchars($functionsArraySetup['title']) . '</a></td>
						</tr>';
                }
            }
            // Imploding around the divider table row:
            $this->content .= implode('
					<tr>
						<td colspan="2"><img' . t3lib_iconWorks::skinImg($backPath, 'gfx/altmenuline.gif', 'width="105" height="3"') . ' alt="" /></td>
					</tr>', $rows);
            $this->content .= '
				</table>';
            $this->content .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'menu_adminFunction', $GLOBALS['BACK_PATH']);
            $this->content .= '
</div>
';
        }
        // superuser mode
        if ($BE_USER->user['ses_backuserid']) {
            $username = '******' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:switchtousershort') . ' ' . htmlspecialchars($BE_USER->user['username']) . ']</p>';
        } else {
            $username = '******' . htmlspecialchars($BE_USER->user['username']) . ']</p>';
        }
        // Printing buttons (logout button)
        $this->content .= '


<!--
  Logout button / username
-->
<div id="typo3-alt-menu-php-logininfo">' . $alt_menuObj->topButtons() . $username . '
</div>';
        // End page:
        $this->content .= $TBE_TEMPLATE->endPage();
    }
Example #23
0
 /**
  * Create the panel of buttons for submitting the form or otherwise
  * perform operations.
  *
  * @return	array	all available buttons as an assoc. array
  */
 protected function getButtons()
 {
     $buttons = array('csh' => t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']), 'shortcut' => '', 'open_new_window' => $this->openInNewWindow());
     // Shortcut
     if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
         $buttons['shortcut'] = $this->doc->makeShortcutIcon('', 'function', $this->MCONF['name']);
     }
     return $buttons;
 }
    /**
     * Renders the "advanced functions" sidebar item.
     *
     * @param	object		&$pObj: Reference to the page object (the templavoila page module)
     * @return	string		HTML output
     * @access	public
     */
    function renderItem_advancedFunctions(&$pObj)
    {
        global $LANG;
        $tableRows = array('
			<tr class="bgColor4-20">
				<th colspan="2">&nbsp;</th>
			</tr>
		');
        // Render checkbox for showing hidden elements:
        $tableRows[] = '
			<tr class="bgColor4">
				<td width="1%" nowrap="nowrap">
					' . t3lib_BEfunc::cshItem('_MOD_web_txtemplavoilaM1', 'advancedfunctions_showhiddenelements', $this->doc->backPath) . '
					' . $LANG->getLL('sidebar_advancedfunctions_labelshowhidden', 1) . ':
				</td>
				<td>' . t3lib_BEfunc::getFuncCheck($pObj->id, 'SET[tt_content_showHidden]', $pObj->MOD_SETTINGS['tt_content_showHidden'], '', '') . '</td>
			</tr>
		';
        // Render checkbox for showing outline:
        if ($GLOBALS['BE_USER']->isAdmin()) {
            $tableRows[] = '
				<tr class="bgColor4">
					<td width="1%" nowrap="nowrap">
						' . t3lib_BEfunc::cshItem('_MOD_web_txtemplavoilaM1', 'advancedfunctions_showoutline', $this->doc->backPath) . '
						' . $LANG->getLL('sidebar_advancedfunctions_labelshowoutline', 1) . '
					:</td>
					<td>' . t3lib_BEfunc::getFuncCheck($pObj->id, 'SET[showOutline]', $pObj->MOD_SETTINGS['showOutline'], '', '') . '</td>
				</tr>
			';
        }
        // Render cache menu:
        if ($pObj->id > 0) {
            $cacheMenu = $this->doc->clearCacheMenu(intval($pObj->id), FALSE);
            if ($cacheMenu != '') {
                // Show cache functions only if they are available to the user
                $cshItem = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'TCEforms_cacheSelector', $GLOBALS['BACK_PATH'], '', TRUE);
                $tableRows[] = '
					<tr class="bgColor4">
						<td nowrap="nowrap">' . $cshItem . ' ' . $LANG->getLL('sidebar_advancedfunctions_labelcachefunctions', 1) . ':</td>
						<td>' . $cacheMenu . '</td>
					</tr>
				';
            }
        }
        return count($tableRows) ? '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding" width="100%">' . implode('', $tableRows) . '</table>' : '';
    }
    /**
     * Main function, creating content in the frame
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG, $TCA;
        // By default, 5 groups are set
        $this->groupLabels = array(1 => 1, 2 => 1, 3 => 1, 4 => 1, 5 => 1);
        $shortCutGroups = $BE_USER->getTSConfig('options.shortcutGroups');
        if (is_array($shortCutGroups['properties']) && count($shortCutGroups['properties'])) {
            foreach ($shortCutGroups['properties'] as $k => $v) {
                if (strcmp('', $v) && strcmp('0', $v)) {
                    $this->groupLabels[$k] = (string) $v;
                } elseif ($BE_USER->isAdmin()) {
                    unset($this->groupLabels[$k]);
                }
            }
        }
        // List of global groups that will be loaded. All global groups have negative IDs.
        $globalGroups = -100;
        // Group -100 is kind of superglobal and can't be changed.
        if (count($this->groupLabels)) {
            $globalGroups .= ',' . implode(',', array_keys($this->groupLabels));
            $globalGroups = str_replace(',', ',-', $globalGroups);
            // Ugly hack to make the UIDs negative - is there any better solution?
        }
        // Fetching shortcuts to display for this user:
        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_be_shortcuts', '((userid=' . $BE_USER->user['uid'] . ' AND sc_group>=0) OR sc_group IN (' . $globalGroups . '))', '', 'sc_group,sorting');
        // Init vars:
        $this->lines = array();
        $this->linesPre = array();
        $this->editSC_rec = '';
        $this->selOpt = array();
        $formerGr = '';
        // Traverse shortcuts
        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
            $mParts = explode('|', $row['module_name']);
            $row['module_name'] = $mParts[0];
            $row['M_module_name'] = $mParts[1];
            $mParts = explode('_', $row['M_module_name'] ? $row['M_module_name'] : $row['module_name']);
            $qParts = parse_url($row['url']);
            if (!$BE_USER->isAdmin()) {
                // Check for module access
                if (!isset($LANG->moduleLabels['tabs_images'][implode('_', $mParts) . '_tab'])) {
                    // Nice hack to check if the user has access to this module - otherwise the translation label would not have been loaded :-)
                    continue;
                }
                $page_id = $this->getLinkedPageId($row['url']);
                if (t3lib_div::testInt($page_id)) {
                    // Check for webmount access
                    if (!$GLOBALS['BE_USER']->isInWebMount($page_id)) {
                        continue;
                    }
                    // Check for record access
                    $pageRow = t3lib_BEfunc::getRecord('pages', $page_id);
                    if (!$GLOBALS['BE_USER']->doesUserHaveAccess($pageRow, $perms = 1)) {
                        continue;
                    }
                }
            }
            if ($this->editSC && $row['uid'] == $this->editSC) {
                $this->editSC_rec = $row;
            }
            $sc_group = $row['sc_group'];
            if ($sc_group && strcmp($formerGr, $sc_group)) {
                if ($sc_group != -100) {
                    if ($this->groupLabels[abs($sc_group)] && strcmp('1', $this->groupLabels[abs($sc_group)])) {
                        $label = $this->groupLabels[abs($sc_group)];
                    } else {
                        $label = $LANG->getLL('shortcut_group_' . abs($sc_group), 1);
                        if (!$label) {
                            $label = $LANG->getLL('shortcut_group', 1) . ' ' . abs($sc_group);
                        }
                        // Fallback label
                    }
                    if ($sc_group >= 0) {
                        $onC = 'if (confirm(' . $GLOBALS['LANG']->JScharCode($LANG->getLL('shortcut_delAllInCat')) . ')){window.location.href=\'alt_shortcut.php?deleteCategory=' . $sc_group . '\';}return false;';
                        $this->linesPre[] = '<td>&nbsp;</td><td class="bgColor5"><a href="#" onclick="' . htmlspecialchars($onC) . '" title="' . $LANG->getLL('shortcut_delAllInCat', 1) . '">' . $label . '</a></td>';
                    } else {
                        $label = $LANG->getLL('shortcut_global', 1) . ': ' . ($label ? $label : abs($sc_group));
                        // Fallback label
                        $this->lines[] = '<td>&nbsp;</td><td class="bgColor5">' . $label . '</td>';
                    }
                    unset($label);
                }
            }
            $bgColorClass = $row['uid'] == $this->editSC ? 'bgColor5' : ($row['sc_group'] < 0 ? 'bgColor6' : 'bgColor4');
            if ($row['description'] && $row['uid'] != $this->editSC) {
                $label = $row['description'];
            } else {
                $label = t3lib_div::fixed_lgd_cs(rawurldecode($qParts['query']), 150);
            }
            $titleA = $this->itemLabel($label, $row['module_name'], $row['M_module_name']);
            $editSH = $row['sc_group'] >= 0 || $BE_USER->isAdmin() ? 'editSh(' . intval($row['uid']) . ');' : "alert('" . $LANG->getLL('shortcut_onlyAdmin') . "')";
            $jumpSC = 'jump(unescape(\'' . rawurlencode($row['url']) . '\'),\'' . implode('_', $mParts) . '\',\'' . $mParts[0] . '\');';
            $onC = 'if (document.shForm.editShortcut_check && document.shForm.editShortcut_check.checked){' . $editSH . '}else{' . $jumpSC . '}return false;';
            if ($sc_group >= 0) {
                // user defined groups show up first
                $this->linesPre[] = '<td class="' . $bgColorClass . '"><a href="#" onclick="' . htmlspecialchars($onC) . '"><img src="' . $this->getIcon($row['module_name']) . '" title="' . htmlspecialchars($titleA) . '" alt="" /></a></td>';
            } else {
                $this->lines[] = '<td class="' . $bgColorClass . '"><a href="#" onclick="' . htmlspecialchars($onC) . '"><img src="' . $this->getIcon($row['module_name']) . '" title="' . htmlspecialchars($titleA) . '" alt="" /></a></td>';
            }
            if (trim($row['description'])) {
                $kkey = strtolower(substr($row['description'], 0, 20)) . '_' . $row['uid'];
                $this->selOpt[$kkey] = '<option value="' . htmlspecialchars($jumpSC) . '">' . htmlspecialchars(t3lib_div::fixed_lgd_cs($row['description'], 50)) . '</option>';
            }
            $formerGr = $row['sc_group'];
        }
        ksort($this->selOpt);
        array_unshift($this->selOpt, '<option>[' . $LANG->getLL('shortcut_selSC', 1) . ']</option>');
        $this->editLoadedFunc();
        $this->editPageIdFunc();
        if (!$this->editLoaded && t3lib_extMgm::isLoaded('cms')) {
            $editIdCode = '<td nowrap="nowrap">' . $LANG->getLL('shortcut_editID', 1) . ': <input type="text" value="' . ($this->editError ? htmlspecialchars($this->editPage) : '') . '" name="editPage"' . $this->doc->formWidth(15) . ' onchange="submitEditPage(this.value);" />' . ($this->editError ? '&nbsp;<strong><span class="typo3-red">' . htmlspecialchars($this->editError) . '</span></strong>' : '') . (is_array($this->theEditRec) ? '&nbsp;<strong>' . $LANG->getLL('shortcut_loadEdit', 1) . ' \'' . t3lib_BEfunc::getRecordTitle('pages', $this->theEditRec, TRUE) . '\'</strong> (' . htmlspecialchars($this->editPath) . ')' : '') . ($this->searchFor ? '&nbsp;' . $LANG->getLL('shortcut_searchFor', 1) . ' <strong>\'' . htmlspecialchars($this->searchFor) . '\'</strong>' : '') . '</td>';
        } else {
            $editIdCode = '';
        }
        // Adding CSH:
        $editIdCode .= '<td>&nbsp;' . t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'shortcuts', $GLOBALS['BACK_PATH'], '', TRUE) . '</td>';
        // Compile it all:
        $this->content .= '

			<table border="0" cellpadding="0" cellspacing="0" width="99%">
				<tr>
					<td>
						<!--
							Shortcut Display Table:
						-->
						<table border="0" cellpadding="0" cellspacing="2" id="typo3-shortcuts">
							<tr>
							';
        if ($GLOBALS['BE_USER']->getTSConfigVal('options.enableShortcuts')) {
            $this->content .= implode('
								', $this->lines);
        }
        $this->content .= $editIdCode . '
							</tr>
						</table>
					</td>
					<td align="right">';
        if ($this->hasWorkspaceAccess()) {
            $this->content .= $this->workspaceSelector() . t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'workspaceSelector', $GLOBALS['BACK_PATH'], '', TRUE);
        }
        $this->content .= '
					</td>
				</tr>
			</table>
			';
        // Launch Edit page:
        if ($this->theEditRec['uid']) {
            $this->content .= $this->doc->wrapScriptTags('top.loadEditId(' . $this->theEditRec['uid'] . ');');
        }
        // Load alternative table/uid into editing form.
        if (count($this->alternativeTableUid) == 2 && isset($TCA[$this->alternativeTableUid[0]]) && t3lib_div::testInt($this->alternativeTableUid[1])) {
            $JSaction = t3lib_BEfunc::editOnClick('&edit[' . $this->alternativeTableUid[0] . '][' . $this->alternativeTableUid[1] . ']=edit', '', 'dummy.php');
            $this->content .= $this->doc->wrapScriptTags('function editArbitraryElement() { top.content.' . $JSaction . '; } editArbitraryElement();');
        }
        // Load search for something.
        if ($this->searchFor) {
            $firstMP = intval($GLOBALS['WEBMOUNTS'][0]);
            $this->content .= $this->doc->wrapScriptTags('jump(unescape("' . rawurlencode('db_list.php?id=' . $firstMP . '&search_field=' . rawurlencode($this->searchFor) . '&search_levels=4') . '"),"web_list","web");');
        }
    }
Example #26
0
    /**
     * Create the panel of buttons for submitting the form or otherwise perform operations.
     *
     * @return	array	all available buttons as an assoc. array
     */
    protected function getButtons()
    {
        global $TCA, $LANG, $BACK_PATH, $BE_USER;
        $buttons = array('csh' => '', 'view' => '', 'record_list' => '', 'shortcut' => '');
        // CSH
        $buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH'], '', TRUE);
        if ($this->id && is_array($this->pageinfo)) {
            // View page
            $buttons['view'] = '<a href="#"
					onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->pageinfo['uid'], $BACK_PATH, t3lib_BEfunc::BEgetRootLine($this->pageinfo['uid']))) . '"
					title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '
				">' . t3lib_iconWorks::getSpriteIcon('actions-document-view') . '</a>';
            // Shortcut
            if ($BE_USER->mayMakeShortcut()) {
                $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
            }
            // If access to Web>List for user, then link to that module.
            if ($BE_USER->check('modules', 'web_list')) {
                $href = $BACK_PATH . 'db_list.php?id=' . $this->pageinfo['uid'] . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
                $buttons['record_list'] = '<a href="' . htmlspecialchars($href) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-list-open') . '</a>';
            }
        }
        return $buttons;
    }
    /**
     * Main function of class
     *
     * @return	string		HTML output
     */
    function main()
    {
        global $LANG;
        $menu = t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[tsconf_parts]', $this->pObj->MOD_SETTINGS['tsconf_parts'], $this->pObj->MOD_MENU['tsconf_parts']);
        $menu .= '<br /><label for="checkTsconf_alphaSort">' . $GLOBALS['LANG']->getLL('sort_alphabetic', true) . '</label> ' . t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[tsconf_alphaSort]', $this->pObj->MOD_SETTINGS['tsconf_alphaSort'], '', '', 'id="checkTsconf_alphaSort"');
        $menu .= '<br /><br />';
        if ($this->pObj->MOD_SETTINGS['tsconf_parts'] == 99) {
            $TSparts = t3lib_BEfunc::getPagesTSconfig($this->pObj->id, '', 1);
            $lines = array();
            $pUids = array();
            foreach ($TSparts as $k => $v) {
                if ($k != 'uid_0') {
                    if ($k == 'defaultPageTSconfig') {
                        $pTitle = '<strong>' . $GLOBALS['LANG']->getLL('editTSconfig_default', 1) . '</strong>';
                        $editIcon = '';
                    } else {
                        $pUids[] = substr($k, 4);
                        $row = t3lib_BEfunc::getRecordWSOL('pages', substr($k, 4));
                        $pTitle = $this->pObj->doc->getHeader('pages', $row, '', 0);
                        $editIdList = substr($k, 4);
                        $params = '&edit[pages][' . $editIdList . ']=edit&columnsOnly=TSconfig';
                        $onclickUrl = t3lib_BEfunc::editOnClick($params, $GLOBALS['BACK_PATH'], '');
                        $editIcon = '<a href="#" onclick="' . htmlspecialchars($onclickUrl) . '" title="' . $GLOBALS['LANG']->getLL('editTSconfig', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>';
                    }
                    $TScontent = nl2br(htmlspecialchars(trim($v) . chr(10)));
                    $tsparser = t3lib_div::makeInstance('t3lib_TSparser');
                    $tsparser->lineNumberOffset = 0;
                    $TScontent = $tsparser->doSyntaxHighlight(trim($v) . LF, '', 0);
                    $lines[] = '
						<tr><td nowrap="nowrap" class="bgColor5">' . $pTitle . '</td></tr>
						<tr><td nowrap="nowrap" class="bgColor4">' . $TScontent . $editIcon . '</td></tr>
						<tr><td>&nbsp;</td></tr>
					';
                }
            }
            if (count($pUids)) {
                $params = '&edit[pages][' . implode(',', $pUids) . ']=edit&columnsOnly=TSconfig';
                $onclickUrl = t3lib_BEfunc::editOnClick($params, $GLOBALS['BACK_PATH'], '');
                $editIcon = '<a href="#" onclick="' . htmlspecialchars($onclickUrl) . '" title="' . $GLOBALS['LANG']->getLL('editTSconfig_all', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '<strong>' . $GLOBALS['LANG']->getLL('editTSconfig_all', 1) . '</strong>' . '</a>';
            } else {
                $editIcon = '';
            }
            $theOutput .= $this->pObj->doc->section($LANG->getLL('tsconf_title'), t3lib_BEfunc::cshItem('_MOD_' . $GLOBALS['MCONF']['name'], 'tsconfig_edit', $GLOBALS['BACK_PATH'], '|<br />') . $menu . '
					<br /><br />

					<!-- Edit fields: -->
					<table border="0" cellpadding="0" cellspacing="1">' . implode('', $lines) . '</table><br />' . $editIcon, 0, 1);
        } else {
            $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext');
            // Defined global here!
            $tmpl->tt_track = 0;
            // Do not log time-performance information
            $tmpl->fixedLgd = 0;
            $tmpl->linkObjects = 0;
            $tmpl->bType = '';
            $tmpl->ext_expandAllNotes = 1;
            $tmpl->ext_noPMicons = 1;
            switch ($this->pObj->MOD_SETTINGS['tsconf_parts']) {
                case '1':
                    $modTSconfig = t3lib_BEfunc::getModTSconfig($this->pObj->id, 'mod');
                    break;
                case '1a':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_layout', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '1b':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_view', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '1c':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_modules', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '1d':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_list', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '1e':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_info', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '1f':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_func', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '1g':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_ts', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '2':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('RTE', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '5':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TCEFORM', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '6':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TCEMAIN', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '3':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TSFE', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '4':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('user', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                default:
                    $modTSconfig['properties'] = t3lib_BEfunc::getPagesTSconfig($this->pObj->id);
                    break;
            }
            $modTSconfig = $modTSconfig['properties'];
            if (!is_array($modTSconfig)) {
                $modTSconfig = array();
            }
            $theOutput .= $this->pObj->doc->section($LANG->getLL('tsconf_title'), t3lib_BEfunc::cshItem('_MOD_' . $GLOBALS['MCONF']['name'], 'tsconfig_hierarchy', $GLOBALS['BACK_PATH'], '|<br />') . $menu . '

					<!-- Page TSconfig Tree: -->
					<table border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td nowrap="nowrap">' . $tmpl->ext_getObjTree($modTSconfig, '', '', '', '', $this->pObj->MOD_SETTINGS['tsconf_alphaSort']) . '</td>
						</tr>
					</table>', 0, 1);
        }
        // Return output:
        return $theOutput;
    }
Example #28
0
    /**
     * Import part of module
     *
     * @param	array		Content of POST VAR tx_impexp[]..
     * @return	void		Setting content in $this->content
     */
    function importData($inData)
    {
        global $TCA, $LANG, $BE_USER;
        $access = is_array($this->pageinfo) ? 1 : 0;
        if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) {
            if ($BE_USER->user['admin'] && !$this->id) {
                $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
            }
            if ($inData['new_import']) {
                unset($inData['import_mode']);
            }
            $import = t3lib_div::makeInstance('tx_impexp');
            $import->init(0, 'import');
            $import->update = $inData['do_update'];
            $import->import_mode = $inData['import_mode'];
            $import->enableLogging = $inData['enableLogging'];
            $import->global_ignore_pid = $inData['global_ignore_pid'];
            $import->force_all_UIDS = $inData['force_all_UIDS'];
            $import->showDiff = !$inData['notShowDiff'];
            $import->allowPHPScripts = $inData['allowPHPScripts'];
            $import->softrefInputValues = $inData['softrefInputValues'];
            // OUTPUT creation:
            $menuItems = array();
            // Make input selector:
            $path = $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'];
            // must have trailing slash.
            $filesInDir = t3lib_div::getFilesInDir(PATH_site . $path, 't3d,xml', 1, 1);
            $userPath = $this->userSaveFolder();
            //Files from User-Dir
            $filesInUserDir = t3lib_div::getFilesInDir($userPath, 't3d,xml', 1, 1);
            $filesInDir = array_merge($filesInUserDir, $filesInDir);
            if (is_dir(PATH_site . $path . 'export/')) {
                $filesInDir = array_merge($filesInDir, t3lib_div::getFilesInDir(PATH_site . $path . 'export/', 't3d,xml', 1, 1));
            }
            $tempFolder = $this->userTempFolder();
            if ($tempFolder) {
                $temp_filesInDir = t3lib_div::getFilesInDir($tempFolder, 't3d,xml', 1, 1);
                $filesInDir = array_merge($filesInDir, $temp_filesInDir);
            }
            // Configuration
            $row = array();
            $opt = array('');
            foreach ($filesInDir as $file) {
                $opt[$file] = substr($file, strlen(PATH_site));
            }
            $row[] = '<tr class="bgColor5">
					<td colspan="2"><strong>' . $LANG->getLL('importdata_selectFileToImport', 1) . '</strong></td>
				</tr>';
            $row[] = '<tr class="bgColor4">
				<td><strong>' . $LANG->getLL('importdata_file', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'importFile', $GLOBALS['BACK_PATH'], '') . '</td>
				<td>' . $this->renderSelectBox('tx_impexp[file]', $inData['file'], $opt) . '<br />' . sprintf($LANG->getLL('importdata_fromPathS', 1), $path) . (!$import->compress ? '<br /><span class="typo3-red">' . $LANG->getLL('importdata_noteNoDecompressorAvailable', 1) . '</span>' : '') . '</td>
				</tr>';
            $row[] = '<tr class="bgColor5">
					<td colspan="2"><strong>' . $LANG->getLL('importdata_importOptions', 1) . '</strong></td>
				</tr>';
            $row[] = '<tr class="bgColor4">
				<td><strong>' . $LANG->getLL('importdata_update', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'update', $GLOBALS['BACK_PATH'], '') . '</td>
				<td>
					<input type="checkbox" name="tx_impexp[do_update]" id="checkDo_update" value="1"' . ($inData['do_update'] ? ' checked="checked"' : '') . ' />
					<label for="checkDo_update">' . $LANG->getLL('importdata_updateRecords', 1) . '</label><br/>
				<em>(' . $LANG->getLL('importdata_thisOptionRequiresThat', 1) . ')</em>' . ($inData['do_update'] ? '	<hr/>
					<input type="checkbox" name="tx_impexp[global_ignore_pid]" id="checkGlobal_ignore_pid" value="1"' . ($inData['global_ignore_pid'] ? ' checked="checked"' : '') . ' />
					<label for="checkGlobal_ignore_pid">' . $LANG->getLL('importdata_ignorePidDifferencesGlobally', 1) . '</label><br/>
					<em>(' . $LANG->getLL('importdata_ifYouSetThis', 1) . ')</em>
					' : '') . '</td>
				</tr>';
            $row[] = '<tr class="bgColor4">
				<td><strong>' . $LANG->getLL('importdata_options', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'options', $GLOBALS['BACK_PATH'], '') . '</td>
				<td>
					<input type="checkbox" name="tx_impexp[notShowDiff]" id="checkNotShowDiff" value="1"' . ($inData['notShowDiff'] ? ' checked="checked"' : '') . ' />
					<label for="checkNotShowDiff">' . $LANG->getLL('importdata_doNotShowDifferences', 1) . '</label><br/>
					<em>(' . $LANG->getLL('importdata_greenValuesAreFrom', 1) . ')</em>
					<br/><br/>

					' . ($GLOBALS['BE_USER']->isAdmin() ? '
					<input type="checkbox" name="tx_impexp[allowPHPScripts]" id="checkAllowPHPScripts" value="1"' . ($inData['allowPHPScripts'] ? ' checked="checked"' : '') . ' />
					<label for="checkAllowPHPScripts">' . $LANG->getLL('importdata_allowToWriteBanned', 1) . '</label><br/>' : '') . (!$inData['do_update'] && $GLOBALS['BE_USER']->isAdmin() ? '
					<br/>
					<input type="checkbox" name="tx_impexp[force_all_UIDS]" id="checkForce_all_UIDS" value="1"' . ($inData['force_all_UIDS'] ? ' checked="checked"' : '') . ' />
					<label for="checkForce_all_UIDS"><span class="typo3-red">' . $LANG->getLL('importdata_force_all_UIDS', 1) . '</span></label><br/>
					<em>(' . $LANG->getLL('importdata_force_all_UIDS_descr', 1) . ')</em>' : '') . '
				</td>
				</tr>';
            $row[] = '<tr class="bgColor4">
				<td><strong>' . $LANG->getLL('importdata_action', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'action', $GLOBALS['BACK_PATH'], '') . '</td>
				<td>' . (!$inData['import_file'] ? '<input type="submit" value="' . $LANG->getLL('importdata_preview', 1) . '" />' . ($inData['file'] ? ' - <input type="submit" value="' . ($inData['do_update'] ? $LANG->getLL('importdata_update_299e', 1) : $LANG->getLL('importdata_import', 1)) . '" name="tx_impexp[import_file]" onclick="return confirm(\'' . $LANG->getLL('importdata_areYouSure', 1) . '\');" />' : '') : '<input type="submit" name="tx_impexp[new_import]" value="' . $LANG->getLL('importdata_newImport', 1) . '" />') . '
					<input type="hidden" name="tx_impexp[action]" value="import" /></td>
				</tr>';
            $row[] = '<tr class="bgColor4">
				<td><strong>' . $LANG->getLL('importdata_enableLogging', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'enableLogging', $GLOBALS['BACK_PATH'], '') . '</td>
				<td>
					<input type="checkbox" name="tx_impexp[enableLogging]" id="checkEnableLogging" value="1"' . ($inData['enableLogging'] ? ' checked="checked"' : '') . ' />
					<label for="checkEnableLogging">' . $LANG->getLL('importdata_writeIndividualDbActions', 1) . '</label><br/>
					<em>(' . $LANG->getLL('importdata_thisIsDisabledBy', 1) . ')</em>
				</td>
				</tr>';
            $menuItems[] = array('label' => $LANG->getLL('importdata_import', 1), 'content' => '
					<table border="0" cellpadding="1" cellspacing="1">
						' . implode('
						', $row) . '
					</table>
				');
            // Upload file:
            $tempFolder = $this->userTempFolder();
            if ($tempFolder) {
                $row = array();
                $row[] = '<tr class="bgColor5">
						<td colspan="2"><strong>' . $LANG->getLL('importdata_uploadFileFromLocal', 1) . '</strong></td>
					</tr>';
                $row[] = '<tr class="bgColor4">
						<td>' . $LANG->getLL('importdata_browse', 1) . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'upload', $GLOBALS['BACK_PATH'], '') . '</td>
						<td>

								<input type="file" name="upload_1"' . $this->doc->formWidth(35) . ' size="40" />
								<input type="hidden" name="file[upload][1][target]" value="' . htmlspecialchars($tempFolder) . '" />
								<input type="hidden" name="file[upload][1][data]" value="1" /><br />

								<input type="submit" name="_upload" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit', 1) . '" />
								<input type="checkbox" name="overwriteExistingFiles" id="checkOverwriteExistingFiles" value="1" checked="checked" /> <label for="checkOverwriteExistingFiles">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:overwriteExistingFiles', 1) . '</label>
						</td>
					</tr>';
                if (t3lib_div::_POST('_upload')) {
                    $row[] = '<tr class="bgColor4">
							<td>' . $LANG->getLL('importdata_uploadStatus', 1) . '</td>
							<td>' . ($this->fileProcessor->internalUploadMap[1] ? $LANG->getLL('importdata_success', 1) . ' ' . substr($this->fileProcessor->internalUploadMap[1], strlen(PATH_site)) : '<span class="typo3-red">' . $LANG->getLL('importdata_failureNoFileUploaded', 1) . '</span>') . '</td>
						</tr>';
                }
                $menuItems[] = array('label' => $LANG->getLL('importdata_upload'), 'content' => '
						<table border="0" cellpadding="1" cellspacing="1">
							' . implode('
							', $row) . '
						</table>
					');
            }
            // Perform import or preview depending:
            $overviewContent = '';
            $extensionInstallationMessage = '';
            $emURL = '';
            $inFile = t3lib_div::getFileAbsFileName($inData['file']);
            if ($inFile && @is_file($inFile)) {
                $trow = array();
                if ($import->loadFile($inFile, 1)) {
                    // Check extension dependencies:
                    $extKeysToInstall = array();
                    if (is_array($import->dat['header']['extensionDependencies'])) {
                        foreach ($import->dat['header']['extensionDependencies'] as $extKey) {
                            if (!t3lib_extMgm::isLoaded($extKey)) {
                                $extKeysToInstall[] = $extKey;
                            }
                        }
                    }
                    if (count($extKeysToInstall)) {
                        $passParams = t3lib_div::_POST('tx_impexp');
                        unset($passParams['import_mode']);
                        unset($passParams['import_file']);
                        $thisScriptUrl = t3lib_div::getIndpEnv('REQUEST_URI') . '?M=xMOD_tximpexp&id=' . $this->id . t3lib_div::implodeArrayForUrl('tx_impexp', $passParams);
                        $emURL = $this->doc->backPath . 'mod/tools/em/index.php?CMD[requestInstallExtensions]=' . implode(',', $extKeysToInstall) . '&returnUrl=' . rawurlencode($thisScriptUrl);
                        $extensionInstallationMessage = 'Before you can install this T3D file you need to install the extensions "' . implode('", "', $extKeysToInstall) . '". Clicking Import will first take you to the Extension Manager so these dependencies can be resolved.';
                    }
                    if ($inData['import_file']) {
                        if (!count($extKeysToInstall)) {
                            $import->importData($this->id);
                            t3lib_BEfunc::setUpdateSignal('updatePageTree');
                        } else {
                            t3lib_utility_Http::redirect($emURL);
                        }
                    }
                    $import->display_import_pid_record = $this->pageinfo;
                    $overviewContent = $import->displayContentOverview();
                }
                // Meta data output:
                $trow[] = '<tr class="bgColor5">
						<td colspan="2"><strong>' . $LANG->getLL('importdata_metaData', 1) . '</strong></td>
					</tr>';
                $opt = array('');
                foreach ($filesInDir as $file) {
                    $opt[$file] = substr($file, strlen(PATH_site));
                }
                $trow[] = '<tr class="bgColor4">
					<td><strong>' . $LANG->getLL('importdata_title', 1) . '</strong></td>
					<td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['title'])) . '</td>
					</tr>';
                $trow[] = '<tr class="bgColor4">
					<td><strong>' . $LANG->getLL('importdata_description', 1) . '</strong></td>
					<td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['description'])) . '</td>
					</tr>';
                $trow[] = '<tr class="bgColor4">
					<td><strong>' . $LANG->getLL('importdata_notes', 1) . '</strong></td>
					<td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['notes'])) . '</td>
					</tr>';
                $trow[] = '<tr class="bgColor4">
					<td><strong>' . $LANG->getLL('importdata_packager', 1) . '</strong></td>
					<td width="95%">' . nl2br(htmlspecialchars($import->dat['header']['meta']['packager_name'] . ' (' . $import->dat['header']['meta']['packager_username'] . ')')) . '<br/>
						' . $LANG->getLL('importdata_email', 1) . ' ' . $import->dat['header']['meta']['packager_email'] . '</td>
					</tr>';
                // Thumbnail icon:
                if (is_array($import->dat['header']['thumbnail'])) {
                    $pI = pathinfo($import->dat['header']['thumbnail']['filename']);
                    if (t3lib_div::inList('gif,jpg,png,jpeg', strtolower($pI['extension']))) {
                        // Construct filename and write it:
                        $fileName = PATH_site . 'typo3temp/importthumb.' . $pI['extension'];
                        t3lib_div::writeFile($fileName, $import->dat['header']['thumbnail']['content']);
                        // Check that the image really is an image and not a malicious PHP script...
                        if (getimagesize($fileName)) {
                            // Create icon tag:
                            $iconTag = '<img src="' . $this->doc->backPath . '../' . substr($fileName, strlen(PATH_site)) . '" ' . $import->dat['header']['thumbnail']['imgInfo'][3] . ' vspace="5" style="border: solid black 1px;" alt="" />';
                            $trow[] = '<tr class="bgColor4">
								<td><strong>' . $LANG->getLL('importdata_icon', 1) . '</strong></td>
								<td>' . $iconTag . '</td>
								</tr>';
                        } else {
                            t3lib_div::unlink_tempfile($fileName);
                        }
                    }
                }
                $menuItems[] = array('label' => $LANG->getLL('importdata_metaData_1387'), 'content' => '
						<table border="0" cellpadding="1" cellspacing="1">
							' . implode('
							', $trow) . '
						</table>
					');
            }
            // Print errors that might be:
            $errors = $import->printErrorLog();
            $menuItems[] = array('label' => $LANG->getLL('importdata_messages'), 'content' => $errors, 'stateIcon' => $errors ? 2 : 0);
            // Output tabs:
            $content = $this->doc->getDynTabMenu($menuItems, 'tx_impexp_import', -1);
            if ($extensionInstallationMessage) {
                $content = '<div style="border: 1px black solid; margin: 10px 10px 10px 10px; padding: 10px 10px 10px 10px;">' . $this->doc->icons(1) . htmlspecialchars($extensionInstallationMessage) . '</div>' . $content;
            }
            $this->content .= $this->doc->section('', $content, 0, 1);
            // Print overview:
            if ($overviewContent) {
                $this->content .= $this->doc->section($inData['import_file'] ? $LANG->getLL('importdata_structureHasBeenImported', 1) : $LANG->getLL('filterpage_structureToBeImported', 1), $overviewContent, 0, 1);
            }
        }
    }
 /**
  * Main function, rendering the upload file form fields
  *
  * @return	void
  */
 function main()
 {
     // Make page header:
     $this->content = $this->doc->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.pagetitle'));
     $form = $this->renderUploadForm();
     $pageContent = $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.pagetitle')) . $this->doc->section('', $form);
     // Header Buttons
     $docHeaderButtons = array('csh' => t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_upload', $GLOBALS['BACK_PATH']));
     $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $pageContent, 'PATH' => $this->title);
     $this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markerArray);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Example #30
0
    /**
     * Main function, starting the rendering of the list.
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH, $CLIENT;
        // Start document template object:
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->setModuleTemplate('templates/db_list.html');
        // Loading current page record and checking access:
        $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause);
        $access = is_array($this->pageinfo) ? 1 : 0;
        // Initialize the dblist object:
        $dblist = t3lib_div::makeInstance('localRecordList');
        $dblist->backPath = $BACK_PATH;
        $dblist->calcPerms = $BE_USER->calcPerms($this->pageinfo);
        $dblist->thumbs = $BE_USER->uc['thumbnailsByDefault'];
        $dblist->returnUrl = $this->returnUrl;
        $dblist->allFields = $this->MOD_SETTINGS['bigControlPanel'] || $this->table ? 1 : 0;
        $dblist->localizationView = $this->MOD_SETTINGS['localization'];
        $dblist->showClipboard = 1;
        $dblist->disableSingleTableView = $this->modTSconfig['properties']['disableSingleTableView'];
        $dblist->listOnlyInSingleTableMode = $this->modTSconfig['properties']['listOnlyInSingleTableView'];
        $dblist->hideTables = $this->modTSconfig['properties']['hideTables'];
        $dblist->tableTSconfigOverTCA = $this->modTSconfig['properties']['table.'];
        $dblist->clickTitleMode = $this->modTSconfig['properties']['clickTitleMode'];
        $dblist->alternateBgColors = $this->modTSconfig['properties']['alternateBgColors'] ? 1 : 0;
        $dblist->allowedNewTables = t3lib_div::trimExplode(',', $this->modTSconfig['properties']['allowedNewTables'], 1);
        $dblist->deniedNewTables = t3lib_div::trimExplode(',', $this->modTSconfig['properties']['deniedNewTables'], 1);
        $dblist->newWizards = $this->modTSconfig['properties']['newWizards'] ? 1 : 0;
        $dblist->pageRow = $this->pageinfo;
        $dblist->counter++;
        $dblist->MOD_MENU = array('bigControlPanel' => '', 'clipBoard' => '', 'localization' => '');
        $dblist->modTSconfig = $this->modTSconfig;
        // Clipboard is initialized:
        $dblist->clipObj = t3lib_div::makeInstance('t3lib_clipboard');
        // Start clipboard
        $dblist->clipObj->initializeClipboard();
        // Initialize - reads the clipboard content from the user session
        // Clipboard actions are handled:
        $CB = t3lib_div::_GET('CB');
        // CB is the clipboard command array
        if ($this->cmd == 'setCB') {
            // CBH is all the fields selected for the clipboard, CBC is the checkbox fields which were checked. By merging we get a full array of checked/unchecked elements
            // This is set to the 'el' array of the CB after being parsed so only the table in question is registered.
            $CB['el'] = $dblist->clipObj->cleanUpCBC(array_merge((array) t3lib_div::_POST('CBH'), (array) t3lib_div::_POST('CBC')), $this->cmd_table);
        }
        if (!$this->MOD_SETTINGS['clipBoard']) {
            $CB['setP'] = 'normal';
        }
        // If the clipboard is NOT shown, set the pad to 'normal'.
        $dblist->clipObj->setCmd($CB);
        // Execute commands.
        $dblist->clipObj->cleanCurrent();
        // Clean up pad
        $dblist->clipObj->endClipboard();
        // Save the clipboard content
        // This flag will prevent the clipboard panel in being shown.
        // It is set, if the clickmenu-layer is active AND the extended view is not enabled.
        $dblist->dontShowClipControlPanels = $CLIENT['FORMSTYLE'] && !$this->MOD_SETTINGS['bigControlPanel'] && $dblist->clipObj->current == 'normal' && !$BE_USER->uc['disableCMlayers'] && !$this->modTSconfig['properties']['showClipControlPanelsDespiteOfCMlayers'];
        // If there is access to the page, then render the list contents and set up the document template object:
        if ($access) {
            // Deleting records...:
            // Has not to do with the clipboard but is simply the delete action. The clipboard object is used to clean up the submitted entries to only the selected table.
            if ($this->cmd == 'delete') {
                $items = $dblist->clipObj->cleanUpCBC(t3lib_div::_POST('CBC'), $this->cmd_table, 1);
                if (count($items)) {
                    $cmd = array();
                    foreach ($items as $iK => $value) {
                        $iKParts = explode('|', $iK);
                        $cmd[$iKParts[0]][$iKParts[1]]['delete'] = 1;
                    }
                    $tce = t3lib_div::makeInstance('t3lib_TCEmain');
                    $tce->stripslashes_values = 0;
                    $tce->start(array(), $cmd);
                    $tce->process_cmdmap();
                    if (isset($cmd['pages'])) {
                        t3lib_BEfunc::setUpdateSignal('updatePageTree');
                    }
                    $tce->printLogErrorMessages(t3lib_div::getIndpEnv('REQUEST_URI'));
                }
            }
            // Initialize the listing object, dblist, for rendering the list:
            $this->pointer = t3lib_div::intInRange($this->pointer, 0, 100000);
            $dblist->start($this->id, $this->table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
            $dblist->setDispFields();
            // Render versioning selector:
            if (t3lib_extMgm::isLoaded('version')) {
                $dblist->HTMLcode .= $this->doc->getVersionSelector($this->id);
            }
            // Render the list of tables:
            $dblist->generateList();
            // Write the bottom of the page:
            $dblist->writeBottom();
            // Add JavaScript functions to the page:
            $this->doc->JScode = $this->doc->wrapScriptTags('
				function jumpToUrl(URL)	{	//
					window.location.href = URL;
					return false;
				}
				function jumpExt(URL,anchor)	{	//
					var anc = anchor?anchor:"";
					window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc;
					return false;
				}
				function jumpSelf(URL)	{	//
					window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:"");
					return false;
				}

				function setHighlight(id)	{	//
					top.fsMod.recentIds["web"]=id;
					top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank;	// For highlighting

					if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav)	{
						top.content.nav_frame.refresh_nav();
					}
				}
				' . $this->doc->redirectUrls($dblist->listURL()) . '
				' . $dblist->CBfunctions() . '
				function editRecords(table,idList,addParams,CBflag)	{	//
					window.location.href="' . $BACK_PATH . 'alt_doc.php?returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '&edit["+table+"]["+idList+"]=edit"+addParams;
				}
				function editList(table,idList)	{	//
					var list="";

						// Checking how many is checked, how many is not
					var pointer=0;
					var pos = idList.indexOf(",");
					while (pos!=-1)	{
						if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) {
							list+=idList.substr(pointer,pos-pointer)+",";
						}
						pointer=pos+1;
						pos = idList.indexOf(",",pointer);
					}
					if (cbValue(table+"|"+idList.substr(pointer))) {
						list+=idList.substr(pointer)+",";
					}

					return list ? list : idList;
				}

				if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
			');
            // Setting up the context sensitive menu:
            $this->doc->getContextMenuCode();
        }
        // access
        // Begin to compile the whole page, starting out with page header:
        $this->body = '';
        $this->body .= '<form action="' . htmlspecialchars($dblist->listURL()) . '" method="post" name="dblistForm">';
        $this->body .= $dblist->HTMLcode;
        $this->body .= '<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" /></form>';
        // If a listing was produced, create the page footer with search form etc:
        if ($dblist->HTMLcode) {
            // Making field select box (when extended view for a single table is enabled):
            if ($dblist->table) {
                $this->body .= $dblist->fieldSelectBox($dblist->table);
            }
            // Adding checkbox options for extended listing and clipboard display:
            $this->body .= '

					<!--
						Listing options for clipboard and thumbnails
					-->
					<div id="typo3-listOptions">
						<form action="" method="post">';
            $this->body .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], 'db_list.php', $this->table ? '&table=' . $this->table : '', 'id="checkLargeControl"') . ' <label for="checkLargeControl">' . $LANG->getLL('largeControl', 1) . '</label><br />';
            if ($dblist->showClipboard) {
                $this->body .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], 'db_list.php', $this->table ? '&table=' . $this->table : '', 'id="checkShowClipBoard"') . ' <label for="checkShowClipBoard">' . $LANG->getLL('showClipBoard', 1) . '</label><br />';
            }
            $this->body .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[localization]', $this->MOD_SETTINGS['localization'], 'db_list.php', $this->table ? '&table=' . $this->table : '', 'id="checkLocalization"') . ' <label for="checkLocalization">' . $LANG->getLL('localization', 1) . '</label><br />';
            $this->body .= '
						</form>
					</div>';
            $this->body .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_options', $GLOBALS['BACK_PATH']);
            // Printing clipboard if enabled:
            if ($this->MOD_SETTINGS['clipBoard'] && $dblist->showClipboard) {
                $this->body .= $dblist->clipObj->printClipboard();
                $this->body .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_clipboard', $GLOBALS['BACK_PATH']);
            }
            // Search box:
            $this->body .= $dblist->getSearchBox();
            // Display sys-notes, if any are found:
            $this->body .= $dblist->showSysNotesForPage();
        }
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $dblist->getButtons();
        $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->body);
        // Build the <body> for the module
        $this->content = $this->doc->startPage('DB list');
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }