Ejemplo n.º 1
0
 /**
  * Add an entry to the CacheMenuItems array
  *
  * @param array $cacheActions Array of CacheMenuItems
  * @param array $optionValues Array of AccessConfigurations-identifiers (typically  used by userTS with options.clearCache.identifier)
  */
 public function manipulateCacheActions(&$cacheActions, &$optionValues)
 {
     $title = LocalizationUtility::translate('cache_action.title', 'cs_clear_images');
     $icon = '<img ' . IconUtility::skinImg($GLOBALS['BACK_PATH'], ExtensionManagementUtility::extRelPath('cs_clear_images') . 'Resources/Public/Images/clear_cache_icon.png', 'width="16" height="16"') . ' alt="" title="' . $title . '"/>';
     // Clearing of processed images
     $cacheActions[] = array('id' => 'tx_csclearimages', 'title' => $title, 'href' => $this->backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&cacheCmd=tx_csclearimages&ajaxCall=1' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => $icon);
 }
Ejemplo n.º 2
0
 public function init($PA, $fobj)
 {
     $GLOBALS['LANG']->includeLLFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('cal') . 'Resources/Private/Language/locallang_db.xml');
     $this->frequency = $PA['row']['freq'];
     if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7005000) {
         $this->frequency = $PA['row']['freq'][0];
     }
     $this->uid = $PA['row']['uid'];
     $this->row = $PA['row'];
     $this->table = $PA['table'];
     $this->rdateType = $this->row['rdate_type'];
     $this->rdate = $this->row['rdate'];
     $this->rdateValues = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->row['rdate'], 1);
     if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7004000) {
         $this->garbageIcon = '<span class="t3-icon fa t3-icon fa fa-trash"> </span>';
         $this->newIcon = '<span title="' . $GLOBALS['LANG']->getLL('tx_cal_event.add_recurrence') . '" class="t3-icon fa t3-icon fa fa-plus-square"> </span>';
     } else {
         $this->garbageIcon = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/garbage.gif') . ' title="' . $GLOBALS['LANG']->getLL('tx_cal_event.remove_recurrence') . '" alt="' . $GLOBALS['LANG']->getLL('tx_cal_event.delete_recurrence') . '" />';
         $this->newIcon = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/new_el.gif') . ' title="' . $GLOBALS['LANG']->getLL('tx_cal_event.add_recurrence') . '" alt="' . $GLOBALS['LANG']->getLL('tx_cal_event.add_recurrence') . '" />';
     }
     $this->commonJS = '';
     if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7004000) {
         $this->commonJS .= '<script src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('cal') . 'Resources/Public/js/recurui2.js" type="text/javascript"></script>' . chr(10) . '<script src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('cal') . 'Resources/Public/js/url2.js" type="text/javascript"></script>';
     } else {
         $this->commonJS .= '<script src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('cal') . 'Resources/Public/js/recurui.js" type="text/javascript"></script>' . chr(10) . '<script src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('cal') . 'Resources/Public/js/url.js" type="text/javascript"></script>';
     }
     $this->everyMonthText = $GLOBALS['LANG']->getLL('tx_cal_event.recurs_every_month');
     $this->selectedMonthText = $GLOBALS['LANG']->getLL('tx_cal_event.recurs_selected_months');
     $this->counts = $this->getCountsArray();
     $startDay = $this->getWeekStartDay($PA);
     $this->weekdays = $this->getWeekDaysArray($startDay);
     $this->months = $this->getMonthsArray();
 }
Ejemplo n.º 3
0
 /**
  * Render javascript in header
  *
  * @return string the rendered page info icon
  * @see template::getPageInfo() Note: can't call this method as it's protected!
  */
 public function render()
 {
     $doc = $this->getDocInstance();
     $id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
     $pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
     // Add icon with clickmenu, etc:
     if ($pageRecord['uid']) {
         // If there IS a real page
         $alttext = BackendUtility::getRecordIconAltText($pageRecord, 'pages');
         $iconImg = IconUtility::getSpriteIconForRecord('pages', $pageRecord, array('title' => htmlspecialchars($alttext)));
         // Make Icon:
         $theIcon = $doc->wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']);
     } else {
         // On root-level of page tree
         // Make Icon
         $iconImg = '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/i/_icon_website.gif') . ' alt="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '" />';
         if ($GLOBALS['BE_USER']->user['admin']) {
             $theIcon = $doc->wrapClickMenuOnIcon($iconImg, 'pages', 0);
         } else {
             $theIcon = $iconImg;
         }
     }
     // Setting icon with clickmenu + uid
     $pageInfo = $theIcon . '<em>[pid: ' . $pageRecord['uid'] . ']</em>';
     return $pageInfo;
 }
Ejemplo n.º 4
0
    /**
     * Create the page navigation tree in HTML
     *
     * @param array $treeArr Tree array
     * @return string HTML output.
     * @todo Define visibility
     */
    public function printTree($treeArr = '')
    {
        $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
        if (!is_array($treeArr)) {
            $treeArr = $this->tree;
        }
        $out = '';
        $c = 0;
        foreach ($treeArr as $k => $v) {
            $c++;
            $bgColorClass = ($c + 1) % 2 ? 'bgColor' : 'bgColor-10';
            if ($GLOBALS['SOBE']->browser->curUrlInfo['act'] == 'page' && $GLOBALS['SOBE']->browser->curUrlInfo['pageid'] == $v['row']['uid'] && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']) {
                $arrCol = '<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_right.gif', 'width="5" height="9"') . ' class="c-blinkArrowR" alt="" /></td>';
                $bgColorClass = 'bgColor4';
            } else {
                $arrCol = '<td></td>';
            }
            $aOnClick = 'return jumpToUrl(\'' . $this->thisScript . '?act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['row']['uid'] . '\');';
            $cEbullet = $this->ext_isLinkable($v['row']['doktype'], $v['row']['uid']) ? '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/arrowbullet.gif', 'width="18" height="16"') . ' alt="" /></a>' : '';
            $out .= '
				<tr class="' . $bgColorClass . '">
					<td nowrap="nowrap"' . ($v['row']['_CSSCLASS'] ? ' class="' . $v['row']['_CSSCLASS'] . '"' : '') . '>' . $v['HTML'] . $this->wrapTitle($this->getTitleStr($v['row'], $titleLen), $v['row'], $this->ext_pArrPages) . '</td>' . $arrCol . '<td>' . $cEbullet . '</td>
				</tr>';
        }
        $out = '


			<!--
				Navigation Page Tree:
			-->
			<table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
				' . $out . '
			</table>';
        return $out;
    }
 /**
  * Wrapping the record header  (from getRecordHeader())
  *
  * @param string $str HTML content
  * @param array $row Record array.
  * @return string HTML content
  */
 public function wrapRecordHeader($str, $row)
 {
     if ($row['uid'] == $this->moveUid) {
         return '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/content_client.gif', 'width="7" height="10"') . ' alt="" />' . $str;
     } else {
         return $str;
     }
 }
Ejemplo n.º 6
0
    /**
     * Creates the version selector for the page id inputted.
     * Moved out of the core file \TYPO3\CMS\Backend\Template\DocumentTemplate
     *
     * @param int $id Page id to create selector for.
     * @param bool $noAction If set, there will be no button for swapping page.
     * @return void
     * @see \TYPO3\CMS\Backend\Template\DocumentTemplate
     */
    public function getVersionSelector($id, $noAction = FALSE)
    {
        if ($id <= 0) {
            return;
        }
        if ($GLOBALS['BE_USER']->workspace == 0) {
            // Get Current page record:
            $curPage = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $id);
            // If the selected page is not online, find the right ID
            $onlineId = $curPage['pid'] == -1 ? $curPage['t3ver_oid'] : $id;
            // Select all versions of online version:
            $versions = \TYPO3\CMS\Backend\Utility\BackendUtility::selectVersionsOfRecord('pages', $onlineId, 'uid,pid,t3ver_label,t3ver_oid,t3ver_wsid,t3ver_id');
            // If more than one was found...:
            if (count($versions) > 1) {
                $selectorLabel = '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:versionSelect.label', TRUE) . '</strong>';
                // Create selector box entries:
                $opt = array();
                foreach ($versions as $vRow) {
                    if ($vRow['uid'] == $onlineId) {
                        // Live version
                        $label = '[' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:versionSelect.live', TRUE) . ']';
                    } else {
                        $label = $vRow['t3ver_label'] . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:versionId', TRUE) . ' ' . $vRow['t3ver_id'] . ($vRow['t3ver_wsid'] != 0 ? ' ' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:workspaceId', TRUE) . ' ' . $vRow['t3ver_wsid'] : '') . ')';
                    }
                    $opt[] = '<option value="' . htmlspecialchars(GeneralUtility::linkThisScript(array('id' => $vRow['uid']))) . '"' . ($id == $vRow['uid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($label) . '</option>';
                }
                // Add management link:
                $management = '<input type="button" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.mgm', TRUE) . '" onclick="window.location.href=\'' . htmlspecialchars($GLOBALS['BACK_PATH'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => 'pages', 'uid' => $onlineId))) . '\';" />';
                // Create onchange handler:
                $onChange = 'window.location.href=this.options[this.selectedIndex].value;';
                // Controls:
                if ($id == $onlineId) {
                    $controls = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="absmiddle" alt="" /> <strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.online', TRUE) . '</strong>';
                } elseif (!$noAction) {
                    $href = $GLOBALS['TBE_TEMPLATE']->issueCommand('&cmd[pages][' . $onlineId . '][version][swapWith]=' . $id . '&cmd[pages][' . $onlineId . '][version][action]=swap', GeneralUtility::linkThisScript(array('id' => $onlineId)));
                    $controls = '<a href="' . htmlspecialchars($href) . '" class="text-nowrap">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-version-swap-version', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.swapPage', TRUE), 'style' => 'margin-left:5px;vertical-align:bottom;')) . '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.swap', TRUE) . '</strong></a>';
                }
                // Write out HTML code:
                return '
					<!--
						Version selector:
					-->
					<table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector">
						<tr>
							<td>' . $selectorLabel . '</td>
							<td>
								<select onchange="' . htmlspecialchars($onChange) . '">
									' . implode('', $opt) . '
								</select></td>
							<td>' . $controls . '</td>
							<td>' . $management . '</td>
						</tr>
					</table>
				';
            }
        }
    }
Ejemplo n.º 7
0
 /**
  * Renders the icon
  *
  * @param string $icon Icon to be used
  * @param string $title Optional title
  * @return string Content rendered image
  */
 public function render($icon, $title = '')
 {
     if (!empty($icon)) {
         $absIconPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFilename($icon);
         if (file_exists($absIconPath)) {
             $icon = $GLOBALS['BACK_PATH'] . '../' . str_replace(PATH_site, '', $absIconPath);
         }
     } else {
         $icon = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('reports') . 'ext_icon.png';
     }
     $content = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], $icon, 'width="16" height="16"') . ' title="' . htmlspecialchars($title) . '" alt="' . htmlspecialchars($title) . '" />';
     return $content;
 }
Ejemplo n.º 8
0
 /**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $icon = $arguments['icon'];
     $title = $arguments['title'];
     if (!empty($icon)) {
         $absIconPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFilename($icon);
         if (file_exists($absIconPath)) {
             $icon = $GLOBALS['BACK_PATH'] . '../' . str_replace(PATH_site, '', $absIconPath);
         }
     } else {
         $icon = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('reports') . 'ext_icon.png';
     }
     return '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], $icon, 'width="16" height="16"') . ' title="' . htmlspecialchars($title) . '" alt="' . htmlspecialchars($title) . '" />';
 }
Ejemplo n.º 9
0
 /**
  * renders the actual logo code
  *
  * @return string Logo html code snippet to use in the backend
  */
 public function render()
 {
     // Default
     $logoFile = 'gfx/alt_backend_logo.gif';
     if (is_string($this->logo)) {
         // Overwrite
         $logoFile = $this->logo;
     }
     $imgInfo = getimagesize(PATH_site . TYPO3_mainDir . $logoFile);
     $logo = '<a href="' . TYPO3_URL_GENERAL . '" target="_blank">' . '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg('', $logoFile, $imgInfo[3]) . ' title="TYPO3 Content Management System" alt="" />' . '</a>';
     // Overwrite with custom logo
     if ($GLOBALS['TBE_STYLES']['logo']) {
         $imgInfo = @getimagesize(\TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath(PATH_typo3 . $GLOBALS['TBE_STYLES']['logo'], 3));
         $logo = '<a href="' . TYPO3_URL_GENERAL . '" target="_blank">' . '<img src="' . $GLOBALS['TBE_STYLES']['logo'] . '" ' . $imgInfo[3] . ' title="TYPO3 Content Management System" alt="" />' . '</a>';
     }
     return $logo;
 }
Ejemplo n.º 10
0
 /**
  * Create the page navigation tree in HTML
  *
  * @param array Tree array
  * @return string HTML output.
  */
 public function printTree($treeArr = '')
 {
     $titleLen = (int) $GLOBALS['BE_USER']->uc['titleLen'];
     if (!is_array($treeArr)) {
         $treeArr = $this->tree;
     }
     $out = '';
     $closeDepth = array();
     foreach ($treeArr as $treeItem) {
         $classAttr = $treeItem['row']['_CSSCLASS'];
         if ($treeItem['isFirst']) {
             $out .= '<ul class="list-tree">';
         }
         // Add CSS classes to the list item
         if ($treeItem['hasSub']) {
             $classAttr .= ' list-tree-control-open';
         }
         $selected = '';
         if ($GLOBALS['SOBE']->browser->curUrlInfo['act'] == 'page' && $GLOBALS['SOBE']->browser->curUrlInfo['pageid'] == $treeItem['row']['uid'] && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']) {
             $selected = ' bg-success';
         }
         $aOnClick = 'return jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&editorNo=' . $GLOBALS['SOBE']->browser->editorNo . '&contentTypo3Language=' . $GLOBALS['SOBE']->browser->contentTypo3Language . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $treeItem['row']['uid']) . ');';
         $cEbullet = $this->ext_isLinkable($treeItem['row']['doktype'], $treeItem['row']['uid']) ? '<a href="#" class="pull-right" onclick="' . htmlspecialchars($aOnClick) . '"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/arrowbullet.gif', 'width="18" height="16"') . ' alt="" /></a>' : '';
         $out .= '<li' . ($classAttr ? ' class="' . trim($classAttr) . '"' : '') . '><span class="list-tree-group' . $selected . '">' . $cEbullet . $treeItem['HTML'] . $this->wrapTitle($this->getTitleStr($treeItem['row'], $titleLen), $treeItem['row'], $this->ext_pArrPages) . '</span>';
         if (!$treeItem['hasSub']) {
             $out .= '</li>';
         }
         // We have to remember if this is the last one
         // on level X so the last child on level X+1 closes the <ul>-tag
         if ($treeItem['isLast']) {
             $closeDepth[$treeItem['invertedDepth']] = 1;
         }
         // If this is the last one and does not have subitems, we need to close
         // the tree as long as the upper levels have last items too
         if ($treeItem['isLast'] && !$treeItem['hasSub']) {
             for ($i = $treeItem['invertedDepth']; $closeDepth[$i] == 1; $i++) {
                 $closeDepth[$i] = 0;
                 $out .= '</ul></li>';
             }
         }
     }
     $out = '<ul class="list-tree" id="treeRoot">' . $out . '</ul>';
     return $out;
 }
Ejemplo n.º 11
0
 /**
  * The main function. Executes all updates.
  * @return string  The update process output.
  */
 function main()
 {
     if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('do_update') == 'htaccess') {
         $this->removeHtaccessFromUploadFolder();
     }
     $content = '';
     foreach ($this->action as $action) {
         if ($action == 'rename_tables') {
             $content .= $this->renameTables();
         }
     }
     if ($this->hasHtaccessFile()) {
         $content .= '<a href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('do_update' => 'htaccess')) . '">Remove .htaccess file in upload dir<img style="vertical-align:bottom;" ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/refresh_n.gif', 'width="18" height="16"') . '></a><br>';
     }
     if ($content == '') {
         $content = 'Nothing to update!';
     }
     return $content;
 }
 /**
  * Returns the title of a record (from table $table) with the proper link around (that is for "pages"-records a link to the level of that record)
  *
  * @param string $table Table name
  * @param integer $uid UID
  * @param string $title Title string
  * @param array $row Records array (from table name)
  * @return string
  */
 public function linkWrapItems($table, $uid, $title, $row)
 {
     // if we handle translation records, make sure that we refer to the localisation parent with their uid
     if (is_array($GLOBALS['TCA'][$table]['ctrl']) && array_key_exists('transOrigPointerField', $GLOBALS['TCA'][$table]['ctrl'])) {
         $transOrigPointerField = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'];
         if (\TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($row[$transOrigPointerField]) > 0) {
             $uid = $row[$transOrigPointerField];
         }
     }
     $currentImage = '';
     if ($this->browselistObj->curUrlInfo['recordTable'] === $table && $this->browselistObj->curUrlInfo['recordUid'] === $uid) {
         $currentImage = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_right.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
     }
     $title = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $row, FALSE, TRUE);
     if (@$this->browselistObj->mode === 'rte') {
         //used in RTE mode:
         $aOnClick = 'return link_spec(\'' . $this->linkHandler . ':' . $table . ':' . $uid . '\');';
     } else {
         //used in wizard mode
         $aOnClick = 'return link_folder(\'' . $this->linkHandler . ':' . $table . ':' . $uid . '\');';
     }
     return '<a href="#" onclick="' . $aOnClick . '">' . $title . $currentImage . '</a>';
 }
Ejemplo n.º 13
0
 /**
  * Get icon for the row.
  * If $this->iconPath and $this->iconName is set, try to get icon based on those values.
  *
  * @param array $row Item row.
  * @return string Image tag.
  */
 public function getIcon($row)
 {
     if ($this->iconPath && $this->iconName) {
         $icon = '<img' . IconUtility::skinImg('', $this->iconPath . $this->iconName, 'width="18" height="16"') . ' alt=""' . ($this->showDefaultTitleAttribute ? ' title="UID: ' . $row['uid'] . '"' : '') . ' />';
     } else {
         $icon = IconUtility::getSpriteIconForRecord($this->table, $row, array('title' => $this->showDefaultTitleAttribute ? 'UID: ' . $row['uid'] : $this->getTitleAttrib($row), 'class' => 'c-recIcon'));
     }
     return $this->wrapIcon($icon, $row);
 }
Ejemplo n.º 14
0
 /**
  * Get the icon for the root
  * $this->iconPath and $this->rootIconName have to be set.
  *
  * @param array $row Data
  *
  * @return string Image tag
  */
 public function getRootIcon(array $row)
 {
     if (!is_array($row)) {
         if (TYPO3_DLOG) {
             GeneralUtility::devLog('getRootIcon (CommerceTeam\\Commerce\\Tree\\Leaf\\View) gets passed invalid parameters.', COMMERCE_EXTKEY, 3);
         }
         return '';
     }
     $icon = '<img' . IconUtility::skinImg($this->iconPath, $this->rootIconName, 'width="18" height="16"') . ' title="Root" alt="" />';
     return $this->wrapIcon($icon, $row);
 }
Ejemplo n.º 15
0
 /**
  * Get the HTML data required for a bulk selection of files of the TYPO3 Element Browser.
  *
  * @param integer $filesCount Number of files currently displayed
  * @return string HTML data required for a bulk selection of files - if $filesCount is 0, nothing is returned
  * @todo Define visibility
  */
 public function getBulkSelector($filesCount)
 {
     if (!$filesCount) {
         return '';
     }
     $labelToggleSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.xlf:toggleSelection', TRUE);
     $labelImportSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.xlf:importSelection', TRUE);
     // Getting flag for showing/not showing thumbnails:
     $noThumbsInEB = $GLOBALS['BE_USER']->getTSConfigVal('options.noThumbsInEB');
     $out = $this->doc->spacer(10) . '<div>' . '<a href="#" onclick="BrowseLinks.Selector.handle()">' . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/import.gif', 'width="12" height="12"') . ' title="' . $labelImportSelection . '" alt="" /> ' . $labelImportSelection . '</a>&nbsp;&nbsp;&nbsp;' . '<a href="#" onclick="BrowseLinks.Selector.toggle()">' . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/clip_select.gif', 'width="12" height="12"') . ' title="' . $labelToggleSelection . '" alt="" /> ' . $labelToggleSelection . '</a>' . '</div>';
     $thumbNailCheck = '';
     if (!$noThumbsInEB && $this->selectedFolder) {
         // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
         $_MOD_MENU = array('displayThumbs' => '');
         $_MCONF['name'] = 'file_list';
         $_MOD_SETTINGS = BackendUtility::getModuleData($_MOD_MENU, GeneralUtility::_GP('SET'), $_MCONF['name']);
         $addParams = '&act=' . $this->act . '&mode=' . $this->mode . '&expandFolder=' . rawurlencode($this->selectedFolder->getCombinedIdentifier()) . '&bparams=' . rawurlencode($this->bparams);
         $thumbNailCheck = BackendUtility::getFuncCheck('', 'SET[displayThumbs]', $_MOD_SETTINGS['displayThumbs'], GeneralUtility::_GP('M') ? '' : $this->thisScript, $addParams, 'id="checkDisplayThumbs"') . ' <label for="checkDisplayThumbs">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:displayThumbs', TRUE) . '</label>';
         $out .= $this->doc->spacer(5) . $thumbNailCheck . $this->doc->spacer(15);
     } else {
         $out .= $this->doc->spacer(15);
     }
     return $out;
 }
Ejemplo n.º 16
0
 /**
  * Add DB relations entries for a record's rels-array
  *
  * @param array $rels Array of relations
  * @param array $lines Output lines array (is passed by reference and modified)
  * @param string $preCode Pre-HTML code
  * @param array $recurCheck Recursivity check stack
  * @param string $htmlColorClass Alternative HTML color class to use.
  * @return void
  * @access private
  * @see singleRecordLines()
  * @todo Define visibility
  */
 public function addRelations($rels, &$lines, $preCode, $recurCheck = array(), $htmlColorClass = '')
 {
     foreach ($rels as $dat) {
         $table = $dat['table'];
         $uid = $dat['id'];
         $pInfo = array();
         $Iprepend = '';
         $staticFixed = FALSE;
         $pInfo['ref'] = $table . ':' . $uid;
         if (!in_array($pInfo['ref'], $recurCheck)) {
             if ($uid > 0) {
                 $record = $this->dat['header']['records'][$table][$uid];
                 if (!is_array($record)) {
                     if ($this->isTableStatic($table) || $this->isExcluded($table, $uid) || $dat['tokenID'] && !$this->includeSoftref($dat['tokenID'])) {
                         $pInfo['title'] = htmlspecialchars('STATIC: ' . $pInfo['ref']);
                         $Iprepend = '_static';
                         $staticFixed = TRUE;
                     } else {
                         $doesRE = $this->doesRecordExist($table, $uid);
                         $lostPath = $this->getRecordPath($table === 'pages' ? $doesRE['uid'] : $doesRE['pid']);
                         $pInfo['title'] = htmlspecialchars($pInfo['ref']);
                         $pInfo['title'] = '<span title="' . htmlspecialchars($lostPath) . '">' . $pInfo['title'] . '</span>';
                         $pInfo['msg'] = 'LOST RELATION' . (!$doesRE ? ' (Record not found!)' : ' (Path: ' . $lostPath . ')');
                         $Iprepend = '_lost';
                     }
                 } else {
                     $pInfo['title'] = htmlspecialchars($record['title']);
                     $pInfo['title'] = '<span title="' . htmlspecialchars($this->getRecordPath($table === 'pages' ? $record['uid'] : $record['pid'])) . '">' . $pInfo['title'] . '</span>';
                 }
             } else {
                 // Negative values in relation fields. This is typically sys_language fields, fe_users fields etc. They are static values. They CAN theoretically be negative pointers to uids in other tables but this is so rarely used that it is not supported
                 $pInfo['title'] = htmlspecialchars('FIXED: ' . $pInfo['ref']);
                 $staticFixed = TRUE;
             }
             $pInfo['preCode'] = $preCode . '&nbsp;&nbsp;&nbsp;&nbsp;<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/rel_db' . $Iprepend . '.gif', 'width="13" height="12"') . ' align="top" title="' . htmlspecialchars($pInfo['ref']) . '" alt="" />';
             $pInfo['class'] = $htmlColorClass ? $htmlColorClass : 'bgColor3';
             $pInfo['type'] = 'rel';
             if (!$staticFixed || $this->showStaticRelations) {
                 $lines[] = $pInfo;
                 if (is_array($record) && is_array($record['rels'])) {
                     $this->addRelations($record['rels'], $lines, $preCode . '&nbsp;&nbsp;', array_merge($recurCheck, array($pInfo['ref'])), $htmlColorClass);
                 }
             }
         } else {
             $this->error($pInfo['ref'] . ' was recursive...');
         }
     }
 }
 /**
  * Gets the buttons that shall be rendered in the docHeader.
  *
  * @return array Available buttons for the docHeader
  */
 protected function getDocHeaderButtons()
 {
     $buttons = array('addtask' => '', 'close' => '', 'save' => '', 'reload' => '', 'shortcut' => $this->getShortcutButton());
     if (empty($this->CMD) || $this->CMD == 'list' || $this->CMD == 'delete') {
         $buttons['reload'] = '<a href="' . $GLOBALS['MCONF']['_'] . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.reload', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-refresh') . '</a>';
         if ($this->MOD_SETTINGS['function'] === 'scheduler' && count(self::getRegisteredClasses())) {
             $link = $GLOBALS['MCONF']['_'] . '&CMD=add';
             $image = '<img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->backPath, 'gfx/new_el.gif') . ' alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:new', TRUE) . '" />';
             $buttons['addtask'] = '<a href="' . htmlspecialchars($link) . '" ' . 'title="' . $GLOBALS['LANG']->getLL('action.add') . '">' . $image . '</a>';
         }
     }
     if ($this->CMD === 'add' || $this->CMD === 'edit') {
         $buttons['close'] = '<a href="#" onclick="document.location=\'' . $GLOBALS['MCONF']['_'] . '\'" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:cancel', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-close') . '</a>';
         $buttons['save'] = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-save-close', array('html' => '<input type="image" name="data[save]" class="c-inputButton" src="clear.gif" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:saveAndClose', TRUE) . '" />'));
     }
     return $buttons;
 }
Ejemplo n.º 18
0
    /**
     * Creates the listing of records from a single table
     *
     * @param string $table Table name
     * @param int $id Page id
     * @param string $rowlist List of fields to show in the listing.
     * 	Pseudo fields will be added including the record header.
     *
     * @return string HTML table with the listing for the record.
     * @throws UnexpectedValueException If hook was of wrong interface
     */
    public function getTable($table, $id, $rowlist)
    {
        $database = $this->getDatabaseConnection();
        $language = $this->getLanguageService();
        $backendUser = $this->getBackendUser();
        // Init
        $addWhere = '';
        $titleCol = $GLOBALS['TCA'][$table]['ctrl']['label'];
        $thumbsCol = $GLOBALS['TCA'][$table]['ctrl']['thumbnail'];
        $l10nEnabled = $GLOBALS['TCA'][$table]['ctrl']['languageField'] && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] && !$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'];
        $tableCollapsed = !$this->tablesCollapsed[$table] ? FALSE : TRUE;
        // prepare space icon
        $this->spaceIcon = IconUtility::getSpriteIcon('empty-empty', array('style' => 'background-position: 0 10px;'));
        // Cleaning rowlist for duplicates and place the $titleCol
        // as the first column always!
        $this->fieldArray = array();
        // title Column
        // Add title column
        $this->fieldArray[] = $titleCol;
        // Control-Panel
        if (!GeneralUtility::inList($rowlist, '_CONTROL_')) {
            $this->fieldArray[] = '_CONTROL_';
            $this->fieldArray[] = '_AFTERCONTROL_';
        }
        // Clipboard
        if ($this->showClipboard) {
            $this->fieldArray[] = '_CLIPBOARD_';
        }
        // Ref
        if (!$this->dontShowClipControlPanels) {
            $this->fieldArray[] = '_REF_';
            $this->fieldArray[] = '_AFTERREF_';
        }
        // Path
        if ($this->searchLevels) {
            $this->fieldArray[] = '_PATH_';
        }
        // Localization
        if ($this->localizationView && $l10nEnabled) {
            $this->fieldArray[] = '_LOCALIZATION_';
            $this->fieldArray[] = '_LOCALIZATION_b';
            $addWhere .= ' AND (
				' . $GLOBALS['TCA'][$table]['ctrl']['languageField'] . ' <= 0
				OR
				' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . ' = 0
			)';
        }
        // Cleaning up:
        $this->fieldArray = array_unique(array_merge($this->fieldArray, GeneralUtility::trimExplode(',', $rowlist, 1)));
        if ($this->noControlPanels) {
            $tempArray = array_flip($this->fieldArray);
            unset($tempArray['_CONTROL_']);
            unset($tempArray['_CLIPBOARD_']);
            $this->fieldArray = array_keys($tempArray);
        }
        // Creating the list of fields to include in the SQL query:
        $selectFields = $this->fieldArray;
        $selectFields[] = 'uid';
        $selectFields[] = 'pid';
        // adding column for thumbnails
        if ($thumbsCol) {
            $selectFields[] = $thumbsCol;
        }
        if ($table == 'pages') {
            if (ExtensionManagementUtility::isLoaded('cms')) {
                $selectFields[] = 'module';
                $selectFields[] = 'extendToSubpages';
                $selectFields[] = 'nav_hide';
            }
            $selectFields[] = 'doktype';
        }
        if (is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) {
            $selectFields = array_merge($selectFields, $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']);
        }
        if ($GLOBALS['TCA'][$table]['ctrl']['type']) {
            $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['type'];
        }
        if ($GLOBALS['TCA'][$table]['ctrl']['typeicon_column']) {
            $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_column'];
        }
        if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
            $selectFields[] = 't3ver_id';
            $selectFields[] = 't3ver_state';
            $selectFields[] = 't3ver_wsid';
            // Filtered out when tx_commerce_categories in makeFieldList()
            $selectFields[] = 't3ver_swapmode';
        }
        if ($l10nEnabled) {
            $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
            $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'];
        }
        if ($GLOBALS['TCA'][$table]['ctrl']['label_alt']) {
            $selectFields = array_merge($selectFields, GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['label_alt'], 1));
        }
        // Unique list!
        $selectFields = array_unique($selectFields);
        // Making sure that the fields in the field-list ARE in the field-list from TCA!
        $selectFields = array_intersect($selectFields, $this->makeFieldList($table, 1));
        // implode it into a list of fields for the SQL-statement.
        $selFieldList = implode(',', $selectFields);
        $this->selFieldList = $selFieldList;
        /**
         * DB-List getTable
         *
         * @date 2007-11-16
         * @request Malte Jansen <*****@*****.**>
         */
        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'])) {
            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'] as $classData) {
                $hookObject = GeneralUtility::getUserObj($classData);
                if (!$hookObject instanceof \TYPO3\CMS\Backend\RecordList\RecordListGetTableHookInterface) {
                    throw new UnexpectedValueException('$hookObject must implement interface \\TYPO3\\CMS\\Backend\\RecordList\\RecordListGetTableHookInterface', 1195114460);
                }
                $hookObject->getDBlistQuery($table, $id, $addWhere, $selFieldList, $this);
            }
        }
        // Create the SQL query for selecting the elements in the listing:
        // do not do paging when outputting as CSV
        if ($this->csvOutput) {
            $this->iLimit = 0;
        }
        if ($this->firstElementNumber > 2 && $this->iLimit > 0) {
            // Get the two previous rows for sorting if displaying page > 1
            $this->firstElementNumber = $this->firstElementNumber - 2;
            $this->iLimit = $this->iLimit + 2;
            // (API function from class.db_list.inc)
            $queryParts = $this->makeQueryArray($table, $id, $addWhere, $selFieldList);
            $this->firstElementNumber = $this->firstElementNumber + 2;
            $this->iLimit = $this->iLimit - 2;
        } else {
            // (API function from class.db_list.inc)
            $queryParts = $this->makeQueryArray($table, $id, $addWhere, $selFieldList);
        }
        // Finding the total amount of records on the page
        $this->setTotalItems($queryParts);
        // Init:
        $dbCount = 0;
        $out = '';
        $listOnlyInSingleTableMode = $this->listOnlyInSingleTableMode && !$this->table;
        $result = FALSE;
        // If the count query returned any number of records,
        // we perform the real query, selecting records.
        if ($this->totalItems) {
            // Fetch records only if not in single table mode or
            // if in multi table mode and not collapsed
            if ($listOnlyInSingleTableMode || !$this->table && $tableCollapsed) {
                $dbCount = $this->totalItems;
            } else {
                // set the showLimit to the number of records when outputting as CSV
                if ($this->csvOutput) {
                    $this->showLimit = $this->totalItems;
                    $this->iLimit = $this->totalItems;
                }
                $result = $database->exec_SELECT_queryArray($queryParts);
                $dbCount = $database->sql_num_rows($result);
            }
        }
        // If any records was selected, render the list:
        if ($dbCount) {
            // Half line is drawn between tables:
            if (!$listOnlyInSingleTableMode) {
                $theData = array();
                if (!$this->table && !$rowlist) {
                    $theData[$titleCol] = '<img src="/' . TYPO3_mainDir . '/clear.gif" width="' . ($GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel'] ? '230' : '350') . '" height="1" alt="" />';
                    if (in_array('_CONTROL_', $this->fieldArray)) {
                        $theData['_CONTROL_'] = '';
                    }
                    if (in_array('_CLIPBOARD_', $this->fieldArray)) {
                        $theData['_CLIPBOARD_'] = '';
                    }
                }
                $out .= $this->addelement(0, '', $theData, 'class="c-table-row-spacer"', $this->leftMargin);
            }
            // Header line is drawn
            $theData = array();
            if ($this->disableSingleTableView) {
                $theData[$titleCol] = '<span class="c-table">' . BackendUtility::wrapInHelp($table, '', $language->sL($GLOBALS['TCA'][$table]['ctrl']['title'], TRUE)) . '</span> (' . $this->totalItems . ')';
            } else {
                $theData[$titleCol] = $this->linkWrapTable($table, '<span class="c-table">' . $language->sL($GLOBALS['TCA'][$table]['ctrl']['title'], TRUE) . '</span> (' . $this->totalItems . ') ' . ($this->table ? IconUtility::getSpriteIcon('actions-view-table-collapse', array('title' => $language->getLL('contractView', TRUE))) : IconUtility::getSpriteIcon('actions-view-table-expand', array('title' => $language->getLL('expandView', TRUE)))));
            }
            if ($listOnlyInSingleTableMode) {
                $out .= '
					<tr>
						<td class="t3-row-header" style="width: 95%;">' . BackendUtility::wrapInHelp($table, '', $theData[$titleCol]) . '</td>
					</tr>';
            } else {
                // Render collapse button if in multi table mode
                $collapseIcon = '';
                if (!$this->table) {
                    if ($tableCollapsed) {
                        $options = array('class' => 'collapseIcon', 'title' => $language->sL('LLL:EXT:lang/locallang_core.php:labels.expandTable', TRUE));
                    } else {
                        $options = array('class' => 'collapseIcon', 'title' => $language->sL('LLL:EXT:lang/locallang_core.php:labels.collapseTable', TRUE));
                    }
                    $value = $tableCollapsed ? '0' : '1';
                    $collapseIcon = '<a href="' . htmlspecialchars($this->listURL() . '&collapse[' . $table . ']=' . $value) . '">' . ($tableCollapsed ? IconUtility::getSpriteIcon('actions-view-list-expand', $options) : IconUtility::getSpriteIcon('actions-view-list-collapse', $options)) . '</a>';
                }
                $out .= $this->addElement(1, $collapseIcon, $theData, ' class="t3-row-header"', '');
            }
            $iOut = '';
            // Render table rows only if in multi table view
            // and not collapsed or if in single table view
            if (!$listOnlyInSingleTableMode && (!$tableCollapsed || $this->table)) {
                // Fixing a order table for sortby tables
                $this->currentTable = array();
                $currentIdList = array();
                $doSort = $GLOBALS['TCA'][$table]['ctrl']['sortby'] && !$this->sortField;
                $prevUid = 0;
                $prevPrevUid = 0;
                // Get first two rows and initialize prevPrevUid and prevUid if on page > 1
                if ($this->firstElementNumber > 2 && $this->iLimit > 0) {
                    $row = $database->sql_fetch_assoc($result);
                    $prevPrevUid = -(int) $row['uid'];
                    $row = $database->sql_fetch_assoc($result);
                    $prevUid = $row['uid'];
                }
                // Accumulate rows here
                $accRows = array();
                while ($row = $database->sql_fetch_assoc($result)) {
                    // In offline workspace, look for alternative record:
                    BackendUtility::workspaceOL($table, $row, $this->getBackendUser()->workspace, TRUE);
                    if (is_array($row)) {
                        $accRows[] = $row;
                        $currentIdList[] = $row['uid'];
                        if ($doSort) {
                            if ($prevUid) {
                                $this->currentTable['prev'][$row['uid']] = $prevPrevUid;
                                $this->currentTable['next'][$prevUid] = '-' . $row['uid'];
                                $this->currentTable['prevUid'][$row['uid']] = $prevUid;
                            }
                            $prevPrevUid = isset($this->currentTable['prev'][$row['uid']]) ? -$prevUid : $row['pid'];
                            $prevUid = $row['uid'];
                        }
                    }
                }
                $database->sql_free_result($result);
                $this->totalRowCount = count($accRows);
                // CSV initiated
                if ($this->csvOutput) {
                    $this->initCSV();
                }
                // Render items:
                $this->CBnames = array();
                $this->duplicateStack = array();
                $this->eCounter = $this->firstElementNumber;
                $iOut = '';
                $cc = 0;
                foreach ($accRows as $row) {
                    // Render item row if counter < limit
                    if ($cc < $this->iLimit) {
                        $cc++;
                        $this->translations = FALSE;
                        $iOut .= $this->renderListRow($table, $row, $cc, $titleCol, $thumbsCol);
                        // If localization view is enabled it means that the selected records are
                        // either default or All language and here we will not select translations
                        // which point to the main record:
                        if ($this->localizationView && $l10nEnabled) {
                            // For each available translation, render the record:
                            if (is_array($this->translations)) {
                                foreach ($this->translations as $lRow) {
                                    // $lRow isn't always what we want - if record was moved we've to work with the
                                    // placeholder records otherwise the list is messed up a bit
                                    if ($row['_MOVE_PLH_uid'] && $row['_MOVE_PLH_pid']) {
                                        $tmpRow = BackendUtility::getRecordRaw($table, 't3ver_move_id="' . (int) $lRow['uid'] . '" AND pid="' . $row['_MOVE_PLH_pid'] . '" AND t3ver_wsid=' . $row['t3ver_wsid'] . BackendUtility::deleteClause($table), $selFieldList);
                                        $lRow = is_array($tmpRow) ? $tmpRow : $lRow;
                                    }
                                    // In offline workspace, look for alternative record:
                                    BackendUtility::workspaceOL($table, $lRow, $this->getBackendUser()->workspace, TRUE);
                                    if (is_array($lRow) && $backendUser->checkLanguageAccess($lRow[$GLOBALS['TCA'][$table]['ctrl']['languageField']])) {
                                        $currentIdList[] = $lRow['uid'];
                                        $iOut .= $this->renderListRow($table, $lRow, $cc, $titleCol, $thumbsCol, 18);
                                    }
                                }
                            }
                        }
                    }
                    // Counter of total rows incremented:
                    $this->eCounter++;
                }
                // Record navigation is added to the beginning and
                // end of the table if in single table mode
                if ($this->table) {
                    $iOut = $this->renderListNavigation('top') . $iOut . $this->renderListNavigation('bottom');
                } else {
                    // show that there are more records than shown
                    if ($this->totalItems > $this->itemsLimitPerTable) {
                        $countOnFirstPage = $this->totalItems > $this->itemsLimitSingleTable ? $this->itemsLimitSingleTable : $this->totalItems;
                        $hasMore = $this->totalItems > $this->itemsLimitSingleTable;
                        $iOut .= '<tr><td colspan="' . count($this->fieldArray) . '" style="padding: 5px;">
							<a href="' . htmlspecialchars($this->listURL() . '&table=' . rawurlencode($table)) . '">' . '<img' . IconUtility::skinImg($this->backPath, 'gfx/pildown.gif', 'width="14" height="14"') . ' alt="" />' . ' <i>[1 - ' . $countOnFirstPage . ($hasMore ? '+' : '') . ']</i></a>
							</td></tr>';
                    }
                }
                // The header row for the table is now created:
                $out .= $this->renderListHeader($table, $currentIdList);
            }
            // The list of records is added after the header:
            $out .= $iOut;
            unset($iOut);
            // ... and it is all wrapped in a table:
            $out = '



			<!--
				DB listing of elements:	"' . htmlspecialchars($table) . '"
			-->
				<table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist' . ($listOnlyInSingleTableMode ? ' typo3-dblist-overview' : '') . '">
					' . $out . '
				</table>';
            // Output csv if...
            if ($this->csvOutput) {
                // This ends the page with exit.
                $this->outputCSV($table);
            }
        }
        // Return content:
        return $out;
    }
Ejemplo n.º 19
0
    /**
     * Prints the items from input $menuItems array - both as topframe menu AND the JS section for writing to the div-layers.
     * Of course the topframe menu will appear only if $this->doDisplayTopFrameCM() returns TRUE
     *
     * @param array $menuItems Array
     * @param string $item HTML code for the element which was clicked - shown in the end of the horizontal menu in topframe after the close-button.
     * @return string HTML code
     * @todo Define visibility
     */
    public function printItems($menuItems, $item)
    {
        $out = '';
        // Enable/Disable items:
        $menuItems = $this->enableDisableItems($menuItems);
        // Clean up spacers:
        $menuItems = $this->cleanUpSpacers($menuItems);
        // Adding topframe part (horizontal clickmenu)
        if ($this->doDisplayTopFrameCM()) {
            $out .= '

				<!--
					Table, which contains the click menu when shown in the top frame of the backend:
				-->
				<table border="0" cellpadding="0" cellspacing="0" id="typo3-CSM-top">
					<tr>

							<!-- Items: -->
						<td class="c-item">' . implode('</td>
						<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->PH_backPath, 'gfx/acm_spacer2.gif', 'width="8" height="12"') . ' alt="" /></td>
						<td class="c-item">', $this->menuItemsForTopFrame($menuItems)) . '</td>

							<!-- Close button: -->
						<td class="c-closebutton"><a href="#" onclick="hideCM();return false;">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-close', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.close', 1))) . '</a></td>

							<!-- The item of the clickmenu: -->
						<td class="c-itemicon">' . $item . '</td>
					</tr>
				</table>
			';
            // Set remaining BACK_PATH to blank (if any)
            $out = str_replace($this->PH_backPath, '', $out);
        }
        // Adding JS part:
        $out .= $this->printLayerJScode($menuItems);
        // Return the content
        return $out;
    }
Ejemplo n.º 20
0
    /**
     * Prints the clipboard
     *
     * @return string HTML output
     * @todo Define visibility
     */
    public function printClipboard()
    {
        $out = array();
        $elCount = count($this->elFromTable($this->fileMode ? '_FILE' : ''));
        // Upper header
        $out[] = '
			<tr class="t3-row-header">
				<td colspan="3">' . \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_clipboard', $this->clLabel('clipboard', 'buttons')) . '</td>
			</tr>';
        // Button/menu header:
        $thumb_url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('CB' => array('setThumb' => $this->clipData['_setThumb'] ? 0 : 1)));
        $rmall_url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('CB' => array('removeAll' => $this->current)));
        // Copymode Selector menu
        $copymode_url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript();
        $moveLabel = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:moveElements'));
        $copyLabel = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:copyElements'));
        $opt = array();
        $opt[] = '<option style="padding-left: 20px; background-image: url(\'' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->backPath, 'gfx/clip_cut.gif', '', 1) . '\'); background-repeat: no-repeat;" value="" ' . ($this->currentMode() == 'copy' ? '' : 'selected="selected"') . '>' . $moveLabel . '</option>';
        $opt[] = '<option style="padding-left: 20px; background-image: url(\'' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->backPath, 'gfx/clip_copy.gif', '', 1) . '\'); background-repeat: no-repeat;" value="1" ' . ($this->currentMode() == 'copy' ? 'selected="selected"' : '') . '>' . $copyLabel . '</option>';
        $copymode_selector = ' <select name="CB[setCopyMode]" onchange="this.form.method=\'POST\'; this.form.action=\'' . htmlspecialchars($copymode_url . '&CB[setCopyMode]=') . '\'+(this.options[this.selectedIndex].value); this.form.submit(); return true;" >' . implode('', $opt) . '</select>';
        // Selector menu + clear button
        $opt = array();
        $opt[] = '<option value="" selected="selected">' . $this->clLabel('menu', 'rm') . '</option>';
        // Import / Export link:
        if ($elCount && \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('impexp')) {
            $opt[] = '<option value="' . htmlspecialchars('window.location.href=\'' . $this->backPath . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('impexp') . 'app/index.php' . $this->exportClipElementParameters() . '\';') . '">' . $this->clLabel('export', 'rm') . '</option>';
        }
        // Edit:
        if (!$this->fileMode && $elCount) {
            $opt[] = '<option value="' . htmlspecialchars('window.location.href=\'' . $this->editUrl() . '&returnUrl=\'+top.rawurlencode(window.location.href);') . '">' . $this->clLabel('edit', 'rm') . '</option>';
        }
        // Delete:
        if ($elCount) {
            if ($GLOBALS['BE_USER']->jsConfirmation(4)) {
                $js = '
			if (confirm(' . $GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.deleteClip'), $elCount)) . ')){
				window.location.href=\'' . $this->deleteUrl(0, $this->fileMode ? 1 : 0) . '&redirect=\'+top.rawurlencode(window.location.href);
			}
					';
            } else {
                $js = ' window.location.href=\'' . $this->deleteUrl(0, $this->fileMode ? 1 : 0) . '&redirect=\'+top.rawurlencode(window.location.href); ';
            }
            $opt[] = '<option value="' . htmlspecialchars($js) . '">' . $this->clLabel('delete', 'rm') . '</option>';
        }
        $selector_menu = '<select name="_clipMenu" onchange="eval(this.options[this.selectedIndex].value);this.selectedIndex=0;">' . implode('', $opt) . '</select>';
        $out[] = '
			<tr class="typo3-clipboard-head">
				<td nowrap="nowrap">' . '<a href="' . htmlspecialchars($thumb_url) . '#clip_head">' . '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->backPath, 'gfx/thumb_' . ($this->clipData['_setThumb'] ? 's' : 'n') . '.gif', 'width="21" height="16"') . ' vspace="2" border="0" title="' . $this->clLabel('thumbmode_clip') . '" alt="" />' . '</a>' . '</td>
				<td width="95%" nowrap="nowrap">' . $copymode_selector . ' ' . $selector_menu . '</td>
				<td>' . '<a href="' . htmlspecialchars($rmall_url) . '#clip_head">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-close', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:buttons.clear', TRUE))) . '</a></td>
			</tr>';
        // Print header and content for the NORMAL tab:
        $out[] = '
			<tr class="bgColor5">
				<td colspan="3"><a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('CB' => array('setP' => 'normal')))) . '#clip_head">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-table-' . ($this->current == 'normal' ? 'collapse' : 'expand')) . $this->padTitleWrap('Normal', 'normal') . '</a></td>
			</tr>';
        if ($this->current == 'normal') {
            $out = array_merge($out, $this->printContentFromTab('normal'));
        }
        // Print header and content for the NUMERIC tabs:
        for ($a = 1; $a <= $this->numberTabs; $a++) {
            $out[] = '
				<tr class="bgColor5">
					<td colspan="3"><a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('CB' => array('setP' => 'tab_' . $a)))) . '#clip_head">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-table-' . ($this->current == 'tab_' . $a ? 'collapse' : 'expand')) . $this->padTitleWrap($this->clLabel('cliptabs') . $a, 'tab_' . $a) . '</a></td>
				</tr>';
            if ($this->current == 'tab_' . $a) {
                $out = array_merge($out, $this->printContentFromTab('tab_' . $a));
            }
        }
        // Wrap accumulated rows in a table:
        $output = '<a name="clip_head"></a>

			<!--
				TYPO3 Clipboard:
			-->
			<table cellpadding="0" cellspacing="1" border="0" width="290" id="typo3-clipboard">
				' . implode('', $out) . '
			</table>';
        // Wrap in form tag:
        $output = '<form action="">' . $output . '</form>';
        // Return the accumulated content:
        return $output;
    }
Ejemplo n.º 21
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('close' => '', 'save' => '', 'save_view' => '', 'save_close' => '', 'shortcut' => '', 'undo' => '');
     if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) {
         $closeUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']);
         // Getting settings for the undo button:
         $undoButton = 0;
         $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->P['table'], 'sys_history') . ' AND recuid=' . intval($this->P['uid']), '', 'tstamp DESC', '1');
         if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
             $undoButton = 1;
         }
         // Close
         $buttons['close'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(unescape(\'' . rawurlencode($closeUrl) . '\')); return false;') . '">' . '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/closedok.gif') . ' class="c-inputButton" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', 1) . '" alt="" />' . '</a>';
         // Save
         $buttons['save'] = '<a href="#" onclick="TBE_EDITOR.checkAndDoSubmit(1); return false;">' . '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/savedok.gif') . ' class="c-inputButton" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" alt="" />' . '</a>';
         // Save & View
         if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('cms')) {
             $buttons['save_view'] = '<a href="#" onclick="' . htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR.checkAndDoSubmit(1); return false;') . '">' . '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/savedokshow.gif') . ' class="c-inputButton" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow', 1) . '" alt="" />' . '</a>';
         }
         // Save & Close
         $buttons['save_close'] = '<input type="image" class="c-inputButton" onclick="' . htmlspecialchars('document.editform.redirect.value=\'' . $closeUrl . '\'; TBE_EDITOR.checkAndDoSubmit(1); return false;') . '" name="_saveandclosedok"' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/saveandclosedok.gif', '') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc', 1) . '" />';
         // Undo/Revert:
         if ($undoButton) {
             $buttons['undo'] = '<a href="#" onclick="' . htmlspecialchars('window.location.href=\'show_rechis.php?element=' . rawurlencode($this->P['table'] . ':' . $this->P['uid']) . '&revert=' . rawurlencode('field:' . $this->P['field']) . '&sumUp=-1&returnUrl=' . rawurlencode($this->R_URI) . '\'; return false;') . '">' . '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->doc->backPath, 'gfx/undo.gif') . ' class="c-inputButton" title="' . htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('rte_undoLastChange'), \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $undoButtonR['tstamp'], $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')))) . '" alt="" />' . '</a>';
         }
         // Shortcut
         if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
             $buttons['shortcut'] = $this->doc->makeShortcutIcon('P', '', $this->MCONF['name'], 1);
         }
     }
     return $buttons;
 }
    /**
     * Main
     *
     * @return string
     * @todo Define visibility
     */
    public function main()
    {
        global $BACK_PATH;
        global $tmpl, $tplRow, $theConstants;
        $POST = GeneralUtility::_POST();
        // Checking for more than one template an if, set a menu...
        $manyTemplatesMenu = $this->pObj->templateMenu();
        $template_uid = 0;
        if ($manyTemplatesMenu) {
            $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
        }
        // BUGBUG: Should we check if the user may at all read and write template-records???
        $bType = $this->pObj->MOD_SETTINGS['ts_browser_type'];
        $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
        // initialize
        if ($existTemplate) {
            $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('currentTemplate'), ' <img ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], \TYPO3\CMS\Backend\Utility\IconUtility::getIcon('sys_template', $tplRow)) . ' align="top" /> <strong>' . $this->pObj->linkWrapTemplateTitle($tplRow['title'], $bType == 'setup' ? 'config' : 'constants') . '</strong>' . htmlspecialchars(trim($tplRow['sitetitle']) ? ' (' . $tplRow['sitetitle'] . ')' : ''));
            if ($manyTemplatesMenu) {
                $theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu);
            }
            $theOutput .= $this->pObj->doc->spacer(10);
            if ($POST['add_property'] || $POST['update_value'] || $POST['clear_object']) {
                // add property
                $line = '';
                if (is_array($POST['data'])) {
                    $name = key($POST['data']);
                    if ($POST['data'][$name]['name'] !== '') {
                        // Workaround for this special case: User adds a key and submits by pressing the return key. The form however will use "add_property" which is the name of the first submit button in this form.
                        unset($POST['update_value']);
                        $POST['add_property'] = 'Add';
                    }
                    if ($POST['add_property']) {
                        $property = trim($POST['data'][$name]['name']);
                        if (preg_replace('/[^a-zA-Z0-9_\\.]*/', '', $property) != $property) {
                            $badPropertyMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('noSpaces') . '<br />' . $GLOBALS['LANG']->getLL('nothingUpdated'), $GLOBALS['LANG']->getLL('badProperty'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                            $this->addFlashMessage($badPropertyMessage);
                        } else {
                            $pline = $name . '.' . $property . ' = ' . trim($POST['data'][$name]['propertyValue']);
                            $propertyAddedMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('propertyAdded'));
                            $this->addFlashMessage($propertyAddedMessage);
                            $line .= LF . $pline;
                        }
                    } elseif ($POST['update_value']) {
                        $pline = $name . ' = ' . trim($POST['data'][$name]['value']);
                        $updatedMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('valueUpdated'));
                        $this->addFlashMessage($updatedMessage);
                        $line .= LF . $pline;
                    } elseif ($POST['clear_object']) {
                        if ($POST['data'][$name]['clearValue']) {
                            $pline = $name . ' >';
                            $objectClearedMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('objectCleared'));
                            $this->addFlashMessage($objectClearedMessage);
                            $line .= LF . $pline;
                        }
                    }
                }
                if ($line) {
                    $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
                    // Set the data to be saved
                    $recData = array();
                    $field = $bType == 'setup' ? 'config' : 'constants';
                    $recData['sys_template'][$saveId][$field] = $tplRow[$field] . $line;
                    // Create new  tce-object
                    $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
                    $tce->stripslashes_values = 0;
                    // Initialize
                    $tce->start($recData, array());
                    // Saved the stuff
                    $tce->process_datamap();
                    // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
                    $tce->clear_cacheCmd('all');
                    // re-read the template ...
                    $this->initialize_editor($this->pObj->id, $template_uid);
                }
            }
        }
        $tsbr = GeneralUtility::_GET('tsbr');
        $update = 0;
        if (is_array($tsbr)) {
            // If any plus-signs were clicked, it's registred.
            $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType] = $tmpl->ext_depthKeys($tsbr, $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType]);
            $update = 1;
        }
        if ($POST['Submit']) {
            // If any POST-vars are send, update the condition array
            $this->pObj->MOD_SETTINGS['tsbrowser_conditions'] = $POST['conditions'];
            $update = 1;
        }
        if ($update) {
            $GLOBALS['BE_USER']->pushModuleData($this->pObj->MCONF['name'], $this->pObj->MOD_SETTINGS);
        }
        $tmpl->matchAlternative = $this->pObj->MOD_SETTINGS['tsbrowser_conditions'];
        $tmpl->matchAlternative[] = 'dummydummydummydummydummydummydummydummydummydummydummy';
        // This is just here to make sure that at least one element is in the array so that the tsparser actually uses this array to match.
        $tmpl->constantMode = $this->pObj->MOD_SETTINGS['ts_browser_const'];
        if ($this->pObj->sObj && $tmpl->constantMode) {
            $tmpl->constantMode = 'untouched';
        }
        $tmpl->regexMode = $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'];
        $tmpl->fixedLgd = $this->pObj->MOD_SETTINGS['ts_browser_fixedLgd'];
        $tmpl->linkObjects = TRUE;
        $tmpl->ext_regLinenumbers = TRUE;
        $tmpl->ext_regComments = $this->pObj->MOD_SETTINGS['ts_browser_showComments'];
        $tmpl->bType = $bType;
        $tmpl->resourceCheck = 1;
        $tmpl->removeFromGetFilePath = PATH_site;
        if ($this->pObj->MOD_SETTINGS['ts_browser_type'] == 'const') {
            $tmpl->ext_constants_BRP = (int) GeneralUtility::_GP('breakPointLN');
        } else {
            $tmpl->ext_config_BRP = (int) GeneralUtility::_GP('breakPointLN');
        }
        $tmpl->generateConfig();
        if ($bType == 'setup') {
            $theSetup = $tmpl->setup;
        } else {
            $theSetup = $tmpl->setup_constants;
        }
        // EDIT A VALUE:
        if ($this->pObj->sObj) {
            list($theSetup, $theSetupValue) = $tmpl->ext_getSetup($theSetup, $this->pObj->sObj ? $this->pObj->sObj : '');
            if ($existTemplate) {
                // Value
                $out = '';
                $out .= htmlspecialchars($this->pObj->sObj) . ' =<br />';
                $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][value]" value="' . htmlspecialchars($theSetupValue) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
                $out .= '<input type="Submit" name="update_value" value="' . $GLOBALS['LANG']->getLL('updateButton') . '" />';
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editProperty'), $out, 0, 0);
                // Property
                $out = '';
                $out = '<nobr>' . htmlspecialchars($this->pObj->sObj) . '.';
                $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][name]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' /> = </nobr><br />';
                $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][propertyValue]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />';
                $out .= '<input type="Submit" name="add_property" value="' . $GLOBALS['LANG']->getLL('addButton') . '" />';
                $theOutput .= $this->pObj->doc->spacer(20);
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('addProperty'), $out, 0, 0);
                // clear
                $out = '';
                $out = htmlspecialchars($this->pObj->sObj) . ' <strong>' . $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('clear'), 'toUpper') . '</strong> &nbsp;&nbsp;';
                $out .= '<input type="Checkbox" name="data[' . htmlspecialchars($this->pObj->sObj) . '][clearValue]" value="1" />';
                $out .= '<input type="Submit" name="clear_object" value="' . $GLOBALS['LANG']->getLL('clearButton') . '" />';
                $theOutput .= $this->pObj->doc->spacer(20);
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('clearObject'), $out, 0, 0);
                $theOutput .= $this->pObj->doc->spacer(10);
            } else {
                $noTemplateMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('noCurrentTemplate'), $GLOBALS['LANG']->getLL('edit'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                $this->addFlashMessage($noTemplateMessage);
                $theOutput .= htmlspecialchars($this->pObj->sObj) . ' = <strong>' . htmlspecialchars($theSetupValue) . '</strong>';
                $theOutput .= $this->pObj->doc->spacer(10);
            }
            // Links:
            $out = '';
            $urlParameters = array('id' => $this->pObj->id);
            $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
            if (!$this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$this->pObj->sObj]) {
                if (count($theSetup)) {
                    $out = '<a href="' . htmlspecialchars($aHref . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=1&SET[ts_browser_toplevel_' . $bType . ']=' . rawurlencode($this->pObj->sObj)) . '">';
                    $out .= sprintf($GLOBALS['LANG']->getLL('addKey'), htmlspecialchars($this->pObj->sObj));
                }
            } else {
                $out = '<a href="' . htmlspecialchars($aHref . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0') . '">';
                $out .= sprintf($GLOBALS['LANG']->getLL('removeKey'), htmlspecialchars($this->pObj->sObj));
            }
            if ($out) {
                $theOutput .= $this->pObj->doc->divider(5);
                $theOutput .= $this->pObj->doc->section('', $out);
            }
            // back
            $out = $GLOBALS['LANG']->getLL('back');
            $out = '<a href="' . htmlspecialchars($aHref) . '"><strong>' . $out . '</strong></a>';
            $theOutput .= $this->pObj->doc->divider(5);
            $theOutput .= $this->pObj->doc->section('', $out);
        } else {
            $tmpl->tsbrowser_depthKeys = $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType];
            if (GeneralUtility::_POST('search') && GeneralUtility::_POST('search_field')) {
                // If any POST-vars are send, update the condition array
                $tmpl->tsbrowser_depthKeys = $tmpl->ext_getSearchKeys($theSetup, '', GeneralUtility::_POST('search_field'), array());
            }
            $menu = '<div class="tsob-menu"><label>' . $GLOBALS['LANG']->getLL('browse') . '</label>';
            $menu .= BackendUtility::getFuncMenu($this->pObj->id, 'SET[ts_browser_type]', $bType, $this->pObj->MOD_MENU['ts_browser_type']);
            $menu .= '<label for="ts_browser_toplevel_' . $bType . '">' . $GLOBALS['LANG']->getLL('objectList') . '</label>';
            $menu .= BackendUtility::getFuncMenu($this->pObj->id, 'SET[ts_browser_toplevel_' . $bType . ']', $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType], $this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]);
            //search
            $menu .= '<label for="search_field">' . $GLOBALS['LANG']->getLL('search') . '</label>';
            $menu .= '<input type="Text" name="search_field" id="search_field" value="' . htmlspecialchars($POST['search_field']) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . '/>';
            $menu .= '<input type="Submit" name="search" class="tsob-search-submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:search') . '" />';
            $menu .= BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_regexsearch]', $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'], '', '', 'id="checkTs_browser_regexsearch"');
            $menu .= '<label for="checkTs_browser_regexsearch">' . $GLOBALS['LANG']->getLL('regExp') . '</label>';
            $menu .= '</div>';
            $theOutput .= $this->pObj->doc->section('', '<nobr>' . $menu . '</nobr>');
            $theKey = $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType];
            if (!$theKey || !str_replace('-', '', $theKey)) {
                $theKey = '';
            }
            list($theSetup, $theSetupValue) = $tmpl->ext_getSetup($theSetup, $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] ? $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] : '');
            $tree = $tmpl->ext_getObjTree($theSetup, $theKey, '', '', $theSetupValue, $this->pObj->MOD_SETTINGS['ts_browser_alphaSort']);
            $tree = $tmpl->substituteCMarkers($tree);
            $urlParameters = array('id' => $this->pObj->id);
            $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
            // Parser Errors:
            $pEkey = $bType == 'setup' ? 'config' : 'constants';
            if (count($tmpl->parserErrors[$pEkey])) {
                $errMsg = array();
                $templateAnalyzerInstalled = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tstemplate');
                foreach ($tmpl->parserErrors[$pEkey] as $inf) {
                    $errorLink = '';
                    if ($templateAnalyzerInstalled) {
                        $errorLink = ' <a href="' . htmlspecialchars($aHref . '&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TemplateAnalyzerModuleFunctionController&template=all&SET[ts_analyzer_checkLinenum]=1#line-' . $inf[2]) . '">' . $GLOBALS['LANG']->getLL('errorShowDetails') . '</a>';
                    }
                    $errMsg[] = $inf[1] . ': &nbsp; &nbsp;' . $inf[0] . $errorLink;
                }
                $theOutput .= $this->pObj->doc->spacer(10);
                $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', implode($errMsg, '<br />'), $GLOBALS['LANG']->getLL('errorsWarnings'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                $theOutput .= $flashMessage->render();
            }
            if (isset($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$theKey])) {
                $remove = '<th><a href="' . htmlspecialchars($aHref . '&addKey[' . $theKey . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0') . '">' . $GLOBALS['LANG']->getLL('removeKey') . '</a></th>';
            } else {
                $remove = '';
            }
            $label = $theKey ? $theKey : ($bType == 'setup' ? $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('setupRoot'), 'toUpper') : $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('constantRoot'), 'toUpper'));
            $theOutput .= $this->pObj->doc->spacer(15);
            $theOutput .= $this->pObj->doc->sectionEnd();
            $theOutput .= '<table class="t3-table" id="typo3-objectBrowser">
	<thead>
		<tr>
			<th>' . $label . '</th>' . $remove . '</tr>
	</thead>
	<tbody>
		<tr>
			<td>' . $tree . '</td>' . ($remove ? '<td></td>' : '') . '
		</tr>
	</tbody>
</table>';
            // second row options
            $menu = '<div class="tsob-menu-row2">';
            $menu .= BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_showComments]', $this->pObj->MOD_SETTINGS['ts_browser_showComments'], '', '', 'id="checkTs_browser_showComments"');
            $menu .= '<label for="checkTs_browser_showComments">' . $GLOBALS['LANG']->getLL('displayComments') . '</label>';
            $menu .= BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_alphaSort]', $this->pObj->MOD_SETTINGS['ts_browser_alphaSort'], '', '', 'id="checkTs_browser_alphaSort"');
            $menu .= '<label for="checkTs_browser_alphaSort">' . $GLOBALS['LANG']->getLL('sortAlphabetically') . '</label>';
            $menu .= BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_fixedLgd]', $this->pObj->MOD_SETTINGS['ts_browser_fixedLgd'], '', '', 'id="checkTs_browser_fixedLgd"');
            $menu .= '<label for="checkTs_browser_fixedLgd">' . $GLOBALS['LANG']->getLL('cropLines') . '</label>';
            if ($bType == 'setup' && !$this->pObj->MOD_SETTINGS['ts_browser_fixedLgd']) {
                $menu .= '<br /><br /><label>' . $GLOBALS['LANG']->getLL('displayConstants') . '</label>';
                $menu .= BackendUtility::getFuncMenu($this->pObj->id, 'SET[ts_browser_const]', $this->pObj->MOD_SETTINGS['ts_browser_const'], $this->pObj->MOD_MENU['ts_browser_const']);
            }
            $menu .= '</div>';
            $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('displayOptions'), '<nobr>' . $menu . '</nobr>', 0, 1);
            // Conditions:
            if (is_array($tmpl->sections)) {
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('conditions'), '', 0, 1);
                $out = '';
                foreach ($tmpl->sections as $key => $val) {
                    $out .= '<div class="tsob-conditions"><input class="checkbox" type="checkbox" name="conditions[' . $key . ']" id="check' . $key . '" value="' . htmlspecialchars($val) . '"' . ($this->pObj->MOD_SETTINGS['tsbrowser_conditions'][$key] ? ' checked' : '') . ' />';
                    $out .= '<label for="check' . $key . '">' . $tmpl->substituteCMarkers(htmlspecialchars($val)) . '</label></div>';
                }
                $theOutput .= '<div class="tsob-menu-row2">' . $out . '</div><input type="Submit" name="Submit" value="' . $GLOBALS['LANG']->getLL('setConditions') . '" />';
            }
            // Ending section:
            $theOutput .= $this->pObj->doc->sectionEnd();
        }
        return $theOutput;
    }
Ejemplo n.º 23
0
 /**
  * Fetches the data for the tree
  *
  * @param int $uid Item id for which to select subitems (parent id)
  * @param int $depth Max depth (recursivity limit)
  * @param string $blankLineCode ? (internal)
  * @param string $subCSSclass
  * @return int The count of items on the level
  */
 public function getTree($uid, $depth = 999, $blankLineCode = '', $subCSSclass = '')
 {
     // Buffer for id hierarchy is reset:
     $this->buffer_idH = array();
     // Init vars
     $depth = (int) $depth;
     $HTML = '';
     $a = 0;
     $res = $this->getDataInit($uid, $subCSSclass);
     $c = $this->getDataCount($res);
     $crazyRecursionLimiter = 999;
     $inMenuPages = array();
     $outOfMenuPages = array();
     $outOfMenuPagesTextIndex = array();
     while ($crazyRecursionLimiter > 0 && ($row = $this->getDataNext($res, $subCSSclass))) {
         $crazyRecursionLimiter--;
         // Not in menu:
         if ($this->ext_separateNotinmenuPages && ($row['doktype'] == \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_BE_USER_SECTION || $row['doktype'] >= 200 || $row['nav_hide'])) {
             $outOfMenuPages[] = $row;
             $outOfMenuPagesTextIndex[] = ($row['doktype'] >= 200 ? 'zzz' . $row['doktype'] . '_' : '') . $row['title'];
         } else {
             $inMenuPages[] = $row;
         }
     }
     $label_shownAlphabetically = '';
     if (count($outOfMenuPages)) {
         // Sort out-of-menu pages:
         $outOfMenuPages_alphabetic = array();
         if ($this->ext_alphasortNotinmenuPages) {
             asort($outOfMenuPagesTextIndex);
             $label_shownAlphabetically = ' (alphabetic)';
         }
         foreach ($outOfMenuPagesTextIndex as $idx => $txt) {
             $outOfMenuPages_alphabetic[] = $outOfMenuPages[$idx];
         }
         // Merge:
         $outOfMenuPages_alphabetic[0]['_FIRST_NOT_IN_MENU'] = TRUE;
         $allRows = array_merge($inMenuPages, $outOfMenuPages_alphabetic);
     } else {
         $allRows = $inMenuPages;
     }
     // Traverse the records:
     foreach ($allRows as $row) {
         $a++;
         $newID = $row['uid'];
         // Reserve space.
         $this->tree[] = array();
         end($this->tree);
         // Get the key for this space
         $treeKey = key($this->tree);
         $LN = $a == $c ? 'blank' : 'line';
         // If records should be accumulated, do so
         if ($this->setRecs) {
             $this->recs[$row['uid']] = $row;
         }
         // Accumulate the id of the element in the internal arrays
         $this->ids[] = $idH[$row['uid']]['uid'] = $row['uid'];
         $this->ids_hierarchy[$depth][] = $row['uid'];
         // Make a recursive call to the next level
         if ($depth > 1 && $this->expandNext($newID) && !$row['php_tree_stop']) {
             $nextCount = $this->getTree($newID, $depth - 1, $blankLineCode . ',' . $LN, $row['_SUBCSSCLASS']);
             if (count($this->buffer_idH)) {
                 $idH[$row['uid']]['subrow'] = $this->buffer_idH;
             }
             // Set "did expand" flag
             $exp = 1;
         } else {
             $nextCount = $this->getCount($newID);
             // Clear "did expand" flag
             $exp = 0;
         }
         // Set HTML-icons, if any:
         if ($this->makeHTML) {
             if ($row['_FIRST_NOT_IN_MENU']) {
                 $HTML = '<img' . IconUtility::skinImg($this->backPath, 'gfx/ol/line.gif') . ' alt="" /><br/><img' . IconUtility::skinImg($this->backPath, 'gfx/ol/line.gif') . ' alt="" /><i>Not shown in menu' . $label_shownAlphabetically . ':</i><br>';
             } else {
                 $HTML = '';
             }
             $HTML .= $this->PMicon($row, $a, $c, $nextCount, $exp);
             $HTML .= $this->wrapStop($this->getIcon($row), $row);
         }
         // Finally, add the row/HTML content to the ->tree array in the reserved key.
         $this->tree[$treeKey] = array('row' => $row, 'HTML' => $HTML, 'hasSub' => $nextCount && $this->expandNext($newID), 'isFirst' => $a == 1, 'isLast' => FALSE, 'invertedDepth' => $depth, 'blankLineCode' => $blankLineCode, 'bank' => $this->bank);
     }
     if ($a) {
         $this->tree[$treeKey]['isLast'] = TRUE;
     }
     $this->getDataFree($res);
     $this->buffer_idH = $idH;
     return $c;
 }
Ejemplo n.º 24
0
 /**
  * Insert half/quad lines.
  *
  * @param string $codes Keywords for which lines to insert.
  * @param bool $allBlank If TRUE all lines are just blank clear.gifs
  * @return string HTML content.
  */
 public function insertQuadLines($codes, $allBlank = FALSE)
 {
     $codeA = GeneralUtility::trimExplode(',', $codes . ',line', TRUE);
     $lines = array();
     foreach ($codeA as $code) {
         if ($code == 'blank' || $allBlank) {
             $lines[] = '<img src="clear.gif" width="18" height="8" align="top" alt="" />';
         } else {
             $lines[] = '<img' . IconUtility::skinImg($this->backPath, 'gfx/ol/halfline.gif', 'width="18" height="8"') . ' align="top" alt="" />';
         }
     }
     return implode('', $lines);
 }
Ejemplo n.º 25
0
 /**
  * Get a tree for one storage
  *
  * @param \TYPO3\CMS\Core\Resource\ResourceStorage $storageObject
  * @return void
  */
 public function getBrowseableTreeForStorage(\TYPO3\CMS\Core\Resource\ResourceStorage $storageObject)
 {
     // If there are filemounts, show each, otherwise just the rootlevel folder
     $fileMounts = $storageObject->getFileMounts();
     $rootLevelFolders = array();
     if (count($fileMounts)) {
         foreach ($fileMounts as $fileMountInfo) {
             $rootLevelFolders[] = array('folder' => $fileMountInfo['folder'], 'name' => $fileMountInfo['title']);
         }
     } elseif ($this->BE_USER->isAdmin()) {
         $rootLevelFolders[] = array('folder' => $storageObject->getRootLevelFolder(), 'name' => $storageObject->getName());
     }
     // Clean the tree
     $this->reset();
     // Go through all "root level folders" of this tree (can be the rootlevel folder or any file mount points)
     foreach ($rootLevelFolders as $rootLevelFolderInfo) {
         /** @var $rootLevelFolder \TYPO3\CMS\Core\Resource\Folder */
         $rootLevelFolder = $rootLevelFolderInfo['folder'];
         $rootLevelFolderName = $rootLevelFolderInfo['name'];
         $folderHashSpecUID = GeneralUtility::md5int($rootLevelFolder->getCombinedIdentifier());
         $this->specUIDmap[$folderHashSpecUID] = $rootLevelFolder->getCombinedIdentifier();
         // Hash key
         $storageHashNumber = $this->getShortHashNumberForStorage($storageObject, $rootLevelFolder);
         // Set first:
         $this->bank = $storageHashNumber;
         $isOpen = $this->stored[$storageHashNumber][$folderHashSpecUID] || $this->expandFirst;
         // Set PM icon:
         $cmd = $this->generateExpandCollapseParameter($this->bank, !$isOpen, $rootLevelFolder);
         if (!$storageObject->isBrowsable() || $this->getNumberOfSubfolders($rootLevelFolder) === 0) {
             $rootIcon = 'blank';
         } elseif (!$isOpen) {
             $rootIcon = 'plusonly';
         } else {
             $rootIcon = 'minusonly';
         }
         $icon = '<img' . IconUtility::skinImg($this->backPath, 'gfx/ol/' . $rootIcon . '.gif') . ' alt="" />';
         // Only link icon if storage is browseable
         if (in_array($rootIcon, array('minusonly', 'plusonly'))) {
             $firstHtml = $this->PM_ATagWrap($icon, $cmd);
         } else {
             $firstHtml = $icon;
         }
         // Mark a storage which is not online, as offline
         // maybe someday there will be a special icon for this
         if ($storageObject->isOnline() === FALSE) {
             $rootLevelFolderName .= ' (' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file.xlf:sys_file_storage.isOffline') . ')';
         }
         // Preparing rootRec for the mount
         $firstHtml .= $this->wrapIcon(IconUtility::getSpriteIconForResource($rootLevelFolder, array('mount-root' => TRUE)), $rootLevelFolder);
         $row = array('uid' => $folderHashSpecUID, 'title' => $rootLevelFolderName, 'path' => $rootLevelFolder->getCombinedIdentifier(), 'folder' => $rootLevelFolder);
         // Add the storage root to ->tree
         $this->tree[] = array('HTML' => $firstHtml, 'row' => $row, 'bank' => $this->bank, 'hasSub' => $isOpen && $storageObject->isBrowsable());
         // If the mount is expanded, go down:
         if ($isOpen && $storageObject->isBrowsable()) {
             // Set depth:
             $this->getFolderTree($rootLevelFolder, 999);
         }
     }
 }
Ejemplo n.º 26
0
 /**
  * Creates a link for the rollback
  *
  * @param string $key Parameter which is set to rollbackFields
  * @param string $alt Optional, alternative label and title tag of image
  * @param integer $type Optional, type of rollback: 0 - ALL; 1 - element; 2 - field
  * @return string HTML output
  * @todo Define visibility
  */
 public function createRollbackLink($key, $alt = '', $type = 0)
 {
     return $this->linkPage('<img ' . IconUtility::skinImg('', 'gfx/revert_' . $type . '.gif', 'width="33" height="33"') . ' alt="' . $alt . '" title="' . $alt . '" align="middle" />', array('rollbackFields' => $key));
 }
    /**
     * Creating the module output.
     *
     * @return void
     * @todo Define visibility
     */
    public function main()
    {
        if ($this->id && $this->access) {
            // Init position map object:
            $posMap = GeneralUtility::makeInstance('ext_posMap');
            $posMap->cur_sys_language = $this->sys_language;
            $posMap->backPath = $GLOBALS['BACK_PATH'];
            // If a column is pre-set:
            if (isset($this->colPos)) {
                if ($this->uid_pid < 0) {
                    $row = array();
                    $row['uid'] = abs($this->uid_pid);
                } else {
                    $row = '';
                }
                $this->onClickEvent = $posMap->onClickInsertRecord($row, $this->colPos, '', $this->uid_pid, $this->sys_language);
            } else {
                $this->onClickEvent = '';
            }
            // ***************************
            // Creating content
            // ***************************
            // use a wrapper div
            $this->content .= '<div id="user-setup-wrapper">';
            $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('newContentElement'));
            $this->content .= $this->doc->spacer(5);
            // Wizard
            $code = '';
            $wizardItems = $this->getWizardItems();
            // Wrapper for wizards
            $this->elementWrapper['section'] = array('<ul class="contentelement-wizard list-unstyled">', '</ul>');
            // Copy wrapper for tabs
            $this->elementWrapperForTabs = $this->elementWrapper;
            // Hook for manipulating wizardItems, wrapper, onClickEvent etc.
            if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'])) {
                foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] as $classData) {
                    $hookObject = GeneralUtility::getUserObj($classData);
                    if (!$hookObject instanceof \TYPO3\CMS\Backend\Wizard\NewContentElementWizardHookInterface) {
                        throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\Wizard\\NewContentElementWizardHookInterface', 1227834741);
                    }
                    $hookObject->manipulateWizardItems($wizardItems, $this);
                }
            }
            if ($this->config['renderMode'] == 'tabs' && $this->elementWrapperForTabs != $this->elementWrapper) {
                // Restore wrapper for tabs if they are overwritten in hook
                $this->elementWrapper = $this->elementWrapperForTabs;
            }
            // Add document inline javascript
            $this->doc->JScode = $this->doc->wrapScriptTags('
				function goToalt_doc() {	//
					' . $this->onClickEvent . '
				}

				if(top.refreshMenu) {
					top.refreshMenu();
				} else {
					top.TYPO3ModuleMenu.refreshMenu();
				}
			');
            // Traverse items for the wizard.
            // An item is either a header or an item rendered with a radio button and title/description and icon:
            $cc = $key = 0;
            $menuItems = array();
            foreach ($wizardItems as $k => $wInfo) {
                if ($wInfo['header']) {
                    $menuItems[] = array('label' => htmlspecialchars($wInfo['header']), 'content' => $this->elementWrapper['section'][0]);
                    $key = count($menuItems) - 1;
                } else {
                    $content = '';
                    if (!$this->onClickEvent) {
                        // Radio button:
                        $oC = 'document.editForm.defValues.value=unescape(\'' . rawurlencode($wInfo['params']) . '\');goToalt_doc();' . (!$this->onClickEvent ? 'window.location.hash=\'#sel2\';' : '');
                        $content .= '<div class="contentelement-wizard-item-input"><input type="radio" name="tempB" value="' . htmlspecialchars($k) . '" onclick="' . htmlspecialchars($oC) . '" /></div>';
                        // Onclick action for icon/title:
                        $aOnClick = 'document.getElementsByName(\'tempB\')[' . $cc . '].checked=1;' . $oC . 'return false;';
                    } else {
                        $aOnClick = "document.editForm.defValues.value=unescape('" . rawurlencode($wInfo['params']) . "');goToalt_doc();" . (!$this->onClickEvent ? "window.location.hash='#sel2';" : '');
                    }
                    $menuItems[$key]['content'] .= '<li>
							<div class="contentelement-wizard-item">
								' . $content . '
								<div class="contentelement-wizard-item-icon">
									<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">
										<img' . IconUtility::skinImg($this->doc->backPath, $wInfo['icon'], '') . ' alt="" />
									</a>
								</div>
								<div class="contentelement-wizard-item-text">
									<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">
										<strong>' . htmlspecialchars($wInfo['title']) . '</strong>
										<br />' . nl2br(htmlspecialchars(trim($wInfo['description']))) . '</a>
								</div>
							</div>
						</li>';
                    $cc++;
                }
            }
            // Add closing section-tag
            foreach ($menuItems as $key => $val) {
                $menuItems[$key]['content'] .= $this->elementWrapper['section'][1];
            }
            // Add the wizard table to the content, wrapped in tabs:
            if ($this->config['renderMode'] == 'tabs') {
                $code = $GLOBALS['LANG']->getLL('sel1', 1) . '<br /><br />' . $this->doc->getDynTabMenu($menuItems, 'new-content-element-wizard', FALSE, FALSE);
            } else {
                $code = $GLOBALS['LANG']->getLL('sel1', 1) . '<br /><br />';
                foreach ($menuItems as $section) {
                    $code .= '<h3 class="divider">' . $section['label'] . '</h3>' . $section['content'];
                }
            }
            $this->content .= $this->doc->section(!$this->onClickEvent ? $GLOBALS['LANG']->getLL('1_selectType') : '', $code, 0, 1);
            // If the user must also select a column:
            if (!$this->onClickEvent) {
                // Add anchor "sel2"
                $this->content .= $this->doc->section('', '<a name="sel2"></a>');
                $this->content .= $this->doc->spacer(20);
                // Select position
                $code = $GLOBALS['LANG']->getLL('sel2', 1) . '<br /><br />';
                // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
                $modTSconfig_SHARED = BackendUtility::getModTSconfig($this->id, 'mod.SHARED');
                $colPosList = trim($modTSconfig_SHARED['properties']['colPos_list']) !== '' ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3';
                $colPosList = implode(',', array_unique(GeneralUtility::intExplode(',', $colPosList)));
                // Removing duplicates, if any
                // Finally, add the content of the column selector to the content:
                $code .= $posMap->printContentElementColumns($this->id, 0, $colPosList, 1, $this->R_URI);
                $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('2_selectPosition'), $code, 0, 1);
            }
            // Close wrapper div
            $this->content .= '</div>';
        } else {
            // In case of no access:
            $this->content = '';
            $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('newContentElement'));
            $this->content .= $this->doc->spacer(5);
        }
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers['CSH'] = $docHeaderButtons['csh'];
        $markers['CONTENT'] = $this->content;
        // Build the <body> for the module
        $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('newContentElement'));
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->sectionEnd();
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
Ejemplo n.º 28
0
    /**
     * Rich Text Editor (RTE) user element selector
     *
     * @param 	[type]		$openKeys: ...
     * @return 	[type]		...
     * @todo Define visibility
     */
    public function main_user($openKeys)
    {
        // Starting content:
        $content = $this->doc->startPage($GLOBALS['LANG']->getLL('Insert Custom Element', 1));
        $RTEtsConfigParts = explode(':', \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('RTEtsConfigParams'));
        $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE', \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($RTEtsConfigParts[5]));
        $thisConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::RTEsetup($RTEsetup['properties'], $RTEtsConfigParts[0], $RTEtsConfigParts[2], $RTEtsConfigParts[4]);
        if (is_array($thisConfig['userElements.'])) {
            $categories = array();
            foreach ($thisConfig['userElements.'] as $k => $value) {
                $ki = intval($k);
                $v = $thisConfig['userElements.'][$ki . '.'];
                if (substr($k, -1) == '.' && is_array($v)) {
                    $subcats = array();
                    $openK = $ki;
                    if ($openKeys[$openK]) {
                        $mArray = '';
                        switch ((string) $v['load']) {
                            case 'images_from_folder':
                                $mArray = array();
                                if ($v['path'] && @is_dir(PATH_site . $v['path'])) {
                                    $files = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir(PATH_site . $v['path'], 'gif,jpg,jpeg,png', 0, '');
                                    if (is_array($files)) {
                                        $c = 0;
                                        foreach ($files as $filename) {
                                            $iInfo = @getimagesize(PATH_site . $v['path'] . $filename);
                                            $iInfo = $this->calcWH($iInfo, 50, 100);
                                            $ks = (string) (100 + $c);
                                            $mArray[$ks] = $filename;
                                            $mArray[$ks . '.'] = array('content' => '<img src="' . $this->siteUrl . $v['path'] . $filename . '" />', '_icon' => '<img src="' . $this->siteUrl . $v['path'] . $filename . '" ' . $iInfo[3] . ' />', 'description' => $GLOBALS['LANG']->getLL('filesize') . ': ' . str_replace('&nbsp;', ' ', \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize(@filesize(PATH_site . $v['path'] . $filename))) . ', ' . $GLOBALS['LANG']->getLL('pixels', 1) . ': ' . $iInfo[0] . 'x' . $iInfo[1]);
                                            $c++;
                                        }
                                    }
                                }
                                break;
                        }
                        if (is_array($mArray)) {
                            if ($v['merge']) {
                                $v = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($mArray, $v);
                            } else {
                                $v = $mArray;
                            }
                        }
                        foreach ($v as $k2 => $dummyValue) {
                            $k2i = intval($k2);
                            if (substr($k2, -1) == '.' && is_array($v[$k2i . '.'])) {
                                $title = trim($v[$k2i]);
                                if (!$title) {
                                    $title = '[' . $GLOBALS['LANG']->getLL('noTitle', 1) . ']';
                                } else {
                                    $title = $GLOBALS['LANG']->sL($title, 1);
                                }
                                $description = $GLOBALS['LANG']->sL($v[$k2i . '.']['description'], 1) . '<br />';
                                if (!$v[$k2i . '.']['dontInsertSiteUrl']) {
                                    $v[$k2i . '.']['content'] = str_replace('###_URL###', $this->siteUrl, $v[$k2i . '.']['content']);
                                }
                                $logo = $v[$k2i . '.']['_icon'] ? $v[$k2i . '.']['_icon'] : '';
                                $onClickEvent = '';
                                switch ((string) $v[$k2i . '.']['mode']) {
                                    case 'wrap':
                                        $wrap = explode('|', $v[$k2i . '.']['content']);
                                        $onClickEvent = 'wrapHTML(' . $GLOBALS['LANG']->JScharCode($wrap[0]) . ',' . $GLOBALS['LANG']->JScharCode($wrap[1]) . ',false);';
                                        break;
                                    case 'processor':
                                        $script = trim($v[$k2i . '.']['submitToScript']);
                                        if (substr($script, 0, 4) != 'http') {
                                            $script = $this->siteUrl . $script;
                                        }
                                        if ($script) {
                                            $onClickEvent = 'processSelection(' . $GLOBALS['LANG']->JScharCode($script) . ');';
                                        }
                                        break;
                                    case 'insert':
                                    default:
                                        $onClickEvent = 'insertHTML(' . $GLOBALS['LANG']->JScharCode($v[$k2i . '.']['content']) . ');';
                                        break;
                                }
                                $A = array('<a href="#" onClick="' . $onClickEvent . 'return false;">', '</a>');
                                $subcats[$k2i] = '<tr>
									<td><img src="clear.gif" width="18" height="1" /></td>
									<td class="bgColor4" valign="top">' . $A[0] . $logo . $A[1] . '</td>
									<td class="bgColor4" valign="top">' . $A[0] . '<strong>' . $title . '</strong><br />' . $description . $A[1] . '</td>
								</tr>';
                            }
                        }
                        ksort($subcats);
                    }
                    $categories[$ki] = implode('', $subcats);
                }
            }
            ksort($categories);
            // Render menu of the items:
            $lines = array();
            foreach ($categories as $k => $v) {
                $title = trim($thisConfig['userElements.'][$k]);
                $openK = $k;
                if (!$title) {
                    $title = '[' . $GLOBALS['LANG']->getLL('noTitle', 1) . ']';
                } else {
                    $title = $GLOBALS['LANG']->sL($title, 1);
                }
                $lines[] = '<tr><td colspan="3" class="bgColor5"><a href="#" title="' . $GLOBALS['LANG']->getLL('expand', 1) . '" onClick="jumpToUrl(\'?OC_key=' . ($openKeys[$openK] ? 'C|' : 'O|') . $openK . '\');return false;"><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/' . ($openKeys[$openK] ? 'minus' : 'plus') . 'bullet.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('expand', 1) . '" /><strong>' . $title . '</strong></a></td></tr>';
                $lines[] = $v;
            }
            $content .= '<table border="0" cellpadding="1" cellspacing="1">' . implode('', $lines) . '</table>';
        }
        $content .= $this->doc->endPage();
        return $content;
    }
Ejemplo n.º 29
0
 /**
  * Prints TYPO3 Copyright notice for About Modules etc. modules.
  *
  * Warning:
  * DO NOT prevent this notice from being shown in ANY WAY.
  * According to the GPL license an interactive application must show such a notice on start-up ('If the program is interactive, make it output a short notice... ' - see GPL.txt)
  * Therefore preventing this notice from being properly shown is a violation of the license, regardless of whether you remove it or use a stylesheet to obstruct the display.
  *
  * @param boolean Display the version number within the copyright notice?
  * @return string Text/Image (HTML) for copyright notice.
  */
 public static function TYPO3_copyRightNotice($showVersionNumber = TRUE)
 {
     // Copyright Notice
     $loginCopyrightWarrantyProvider = strip_tags(trim($GLOBALS['TYPO3_CONF_VARS']['SYS']['loginCopyrightWarrantyProvider']));
     $loginCopyrightWarrantyURL = strip_tags(trim($GLOBALS['TYPO3_CONF_VARS']['SYS']['loginCopyrightWarrantyURL']));
     $versionNumber = $showVersionNumber ? ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_login.xlf:version.short') . ' ' . htmlspecialchars(TYPO3_version) : '';
     if (strlen($loginCopyrightWarrantyProvider) >= 2 && strlen($loginCopyrightWarrantyURL) >= 10) {
         $warrantyNote = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_login.xlf:warranty.by'), htmlspecialchars($loginCopyrightWarrantyProvider), '<a href="' . htmlspecialchars($loginCopyrightWarrantyURL) . '" target="_blank">', '</a>');
     } else {
         $warrantyNote = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_login.xlf:no.warranty'), '<a href="' . TYPO3_URL_LICENSE . '" target="_blank">', '</a>');
     }
     $cNotice = '<a href="' . TYPO3_URL_GENERAL . '" target="_blank">' . '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/loginlogo_transp.gif', 'width="75" height="24" vspace="2" hspace="4"') . ' alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_login.xlf:typo3.logo') . '" align="left" />' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_login.xlf:typo3.cms') . $versionNumber . '</a>. ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_login.xlf:copyright') . ' &copy; ' . htmlspecialchars(TYPO3_copyright_year) . ' Kasper Sk&aring;rh&oslash;j. ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_login.xlf:extension.copyright') . ' ' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_login.xlf:details.link'), '<a href="' . TYPO3_URL_GENERAL . '" target="_blank">' . TYPO3_URL_GENERAL . '</a>') . ' ' . strip_tags($warrantyNote, '<a>') . ' ' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_login.xlf:free.software'), '<a href="' . TYPO3_URL_LICENSE . '" target="_blank">', '</a> ') . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_login.xlf:keep.notice');
     return $cNotice;
 }
 /**
  * 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('back' => '', 'close' => '', 'new' => '', 'save' => '', 'save_close' => '', 'view' => '', 'shortcut' => '');
     if ($this->id && $this->access) {
         // View page
         $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
         if ($this->extClassConf['name'] == 'TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateInformationModuleFunctionController') {
             // NEW button
             $buttons['new'] = '<input type="image" class="c-inputButton" name="createExtension" value="New"' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/new_el.gif', '') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle', TRUE) . '" />';
             if (!empty($this->e) && !GeneralUtility::_POST('abort') && !GeneralUtility::_POST('saveclose')) {
                 // no NEW-button while edit
                 $buttons['new'] = '';
                 // SAVE button
                 $buttons['save'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="image" class="c-inputButton" name="submit" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" ' . '/>'));
                 // SAVE AND CLOSE button
                 $buttons['save_close'] = IconUtility::getSpriteIcon('actions-document-save-close', array('html' => '<input type="image" class="c-inputButton" name="saveclose" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" ' . '/>'));
                 // CLOSE button
                 $buttons['close'] = IconUtility::getSpriteIcon('actions-document-close', array('html' => '<input type="image" class="c-inputButton" name="abort" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE) . '" ' . '/>'));
             }
         } elseif ($this->extClassConf['name'] == 'TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateConstantEditorModuleFunctionController' && count($this->MOD_MENU['constant_editor_cat'])) {
             // SAVE button
             $buttons['save'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="image" class="c-inputButton" name="submit" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" ' . '/>'));
         } elseif ($this->extClassConf['name'] == 'TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateObjectBrowserModuleFunctionController') {
             if (!empty($this->sObj)) {
                 // BACK
                 $urlParameters = array('id' => $this->id);
                 $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
                 $buttons['back'] = '<a href="' . htmlspecialchars($aHref) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . IconUtility::getSpriteIcon('actions-view-go-back') . '</a>';
             }
         }
         // Shortcut
         if ($GLOBALS['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']);
         }
     } else {
         // Shortcut
         if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
             $buttons['shortcut'] = $this->doc->makeShortcutIcon('id', '', $this->MCONF['name']);
         }
     }
     return $buttons;
 }