Ejemplo n.º 1
0
 /**
  * Load all necessary Javascript files
  *
  * @param bool $useRequireJsModule
  */
 public function enableRsaEncryption($useRequireJsModule = false)
 {
     if ($this->moduleLoaded || !$this->isAvailable()) {
         return;
     }
     $this->moduleLoaded = true;
     $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
     // Include necessary javascript files
     if ($useRequireJsModule) {
         $pageRenderer->loadRequireJsModule('TYPO3/CMS/Rsaauth/RsaEncryptionModule');
     } else {
         // Register ajax handler url
         $code = 'var TYPO3RsaEncryptionPublicKeyUrl = ' . GeneralUtility::quoteJSvalue(GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'index.php?eID=RsaPublicKeyGenerationController') . ';';
         $pageRenderer->addJsInlineCode('TYPO3RsaEncryptionPublicKeyUrl', $code);
         $javascriptPath = ExtensionManagementUtility::siteRelPath('rsaauth') . 'Resources/Public/JavaScript/';
         if (!$GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['debug']) {
             $files = array('RsaEncryptionWithLib.min.js');
         } else {
             $files = array('RsaLibrary.js', 'RsaEncryption.js');
         }
         foreach ($files as $file) {
             $pageRenderer->addJsFile($javascriptPath . $file);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Wrapping icon in browse tree
  *
  * @param string $thePageIcon Icon IMG code
  * @param array $row Data row for element.
  * @return string Page icon
  * @todo Define visibility
  */
 public function wrapIcon($thePageIcon, &$row)
 {
     // If the record is locked, present a warning sign.
     if ($lockInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::isRecordLocked('pages', $row['uid'])) {
         $aOnClick = 'alert(' . GeneralUtility::quoteJSvalue($lockInfo['msg']) . ');return false;';
         $lockIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . IconUtility::getSpriteIcon('status-warning-in-use', array('title' => $lockInfo['msg'])) . '</a>';
     } else {
         $lockIcon = '';
     }
     // Wrap icon in click-menu link.
     if (!$this->ext_IconMode) {
         $thePageIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($thePageIcon, 'pages', $row['uid'], 0, '&bank=' . $this->bank);
     } elseif ($this->ext_IconMode === 'titlelink') {
         $aOnClick = 'return jumpTo(\'' . $this->getJumpToParam($row) . '\',this,\'' . $this->treeName . '\');';
         $thePageIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $thePageIcon . '</a>';
     }
     // Wrap icon in a drag/drop span.
     $dragDropIcon = '<span class="dragIcon" id="dragIconID_' . $row['uid'] . '">' . $thePageIcon . '</span>';
     // Add Page ID:
     $pageIdStr = '';
     if ($this->ext_showPageId) {
         $pageIdStr = '<span class="dragId">[' . $row['uid'] . ']</span> ';
     }
     // Call stats information hook
     $stat = '';
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
         $_params = array('pages', $row['uid']);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
             $stat .= GeneralUtility::callUserFunction($_funcRef, $_params, $this);
         }
     }
     return $dragDropIcon . $lockIcon . $pageIdStr . $stat;
 }
Ejemplo n.º 3
0
    /**
     * Test if default file format works
     *
     * @test
     * @return void
     */
    public function viewHelperReturnsCorrectJs()
    {
        $newsItem = new Tx_News_Domain_Model_News();
        $newsItem->setTitle('fobar');
        $language = 'en';
        $viewHelper = new Tx_News_ViewHelpers_Social_DisqusViewHelper();
        $settingsService = $this->getAccessibleMock('Tx_News_Service_SettingsService');
        $settingsService->expects($this->any())->method('getSettings')->will($this->returnValue(array('disqusLocale' => $language)));
        $viewHelper->injectSettingsService($settingsService);
        $actualResult = $viewHelper->render($newsItem, 'abcdef', 'http://typo3.org/dummy/fobar.html');
        $expectedCode = '<script type="text/javascript">
					var disqus_shortname = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue('abcdef', TRUE) . ';
					var disqus_identifier = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue('news_' . $newUid, TRUE) . ';
					var disqus_url = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue('http://typo3.org/dummy/fobar.html') . ';
					var disqus_title = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue('fobar', TRUE) . ';
					var disqus_config = function () {
						this.language = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($language) . ';
					};

					(function() {
						var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true;
						dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js";
						(document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
					})();
				</script>';
        $this->assertEquals($expectedCode, $actualResult);
    }
Ejemplo n.º 4
0
    /**
     * Render videos from various video portals
     *
     * @param Tx_News_Domain_Model_Media $element
     * @param integer $width
     * @param integer $height
     * @return string
     */
    public function render(Tx_News_Domain_Model_Media $element, $width, $height)
    {
        $content = $finalUrl = '';
        $url = Tx_News_Service_FileService::getCorrectUrl($element->getContent());
        // get the correct rewritten url
        $mediaWizard = \TYPO3\CMS\Frontend\MediaWizard\MediaWizardProviderManager::getValidMediaWizardProvider($url);
        if ($mediaWizard !== NULL) {
            $finalUrl = $mediaWizard->rewriteUrl($url);
        }
        // override width & height if both are set
        if ($element->getWidth() > 0 && $element->getHeight() > 0) {
            $width = $element->getWidth();
            $height = $element->getHeight();
        }
        if (!empty($finalUrl)) {
            $GLOBALS['TSFE']->getPageRenderer()->addJsFile('typo3conf/ext/news/Resources/Public/JavaScript/Contrib/swfobject-2-2.js');
            $uniqueDivId = 'mediaelement' . Tx_News_Service_FileService::getUniqueId($element);
            $content .= '<div id="' . htmlspecialchars($uniqueDivId) . '"></div>
						<script type="text/javascript">
							var params = { allowScriptAccess: "always", allowfullscreen : "true" };
							var atts = { id: ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($uniqueDivId) . ' };
							swfobject.embedSWF(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($finalUrl) . ',
							' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($uniqueDivId) . ', "' . (int) $width . '", "' . (int) $height . '", "8", null, null, params, atts);
						</script>';
        }
        return $content;
    }
Ejemplo n.º 5
0
    /**
     * Create the page navigation tree in HTML
     *
     * @param 	array		Tree array
     * @return 	string		HTML output.
     * @todo Define visibility
     */
    public function printTree($treeArr = '')
    {
        $titleLen = (int) $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(' . 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=' . $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;
    }
    /**
     * Main function.
     * Creates the header code in XHTML, the JavaScript, then the frameset for the two frames.
     *
     * @return void
     */
    public function main()
    {
        // Setting GPvars:
        $mode = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('mode');
        $bparams = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('bparams');
        $moduleUrl = BackendUtility::getModuleUrl('wizard_element_browser') . '&mode=';
        // Set doktype:
        $GLOBALS['TBE_TEMPLATE']->docType = 'xhtml_frames';
        $GLOBALS['TBE_TEMPLATE']->JScode = $GLOBALS['TBE_TEMPLATE']->wrapScriptTags('
				function closing() {	//
					close();
				}
				function setParams(mode,params) {	//
					parent.content.location.href = ' . GeneralUtility::quoteJSvalue($moduleUrl) . '+mode+"&bparams="+params;
				}
				if (!window.opener) {
					alert("ERROR: Sorry, no link to main window... Closing");
					close();
				}
		');
        $this->content .= $GLOBALS['TBE_TEMPLATE']->startPage($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:TYPO3_Element_Browser'));
        // URL for the inner main frame:
        $url = $GLOBALS['BACK_PATH'] . $moduleUrl . rawurlencode($mode) . '&bparams=' . rawurlencode($bparams);
        // Create the frameset for the window:
        // Formerly there were a ' onunload="closing();"' in the <frameset> tag - but it failed on Safari browser on Mac unless the handler was "onUnload"
        $this->content .= '
			<frameset rows="*,1" framespacing="0" frameborder="0" border="0">
				<frame name="content" src="' . htmlspecialchars($url) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" />
				<frame name="menu" src="' . $GLOBALS['BACK_PATH'] . 'dummy.php" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />
			</frameset>
		';
        $this->content .= '
</html>';
    }
Ejemplo n.º 7
0
    /**
     * Main function.
     * Creates the header code in XHTML, the JavaScript, then the frameset for the two frames.
     *
     * @return void
     */
    public function main()
    {
        // Setting GPvars:
        $mode = GeneralUtility::_GP('mode');
        $bparams = GeneralUtility::_GP('bparams');
        $moduleUrl = BackendUtility::getModuleUrl('wizard_element_browser') . '&mode=';
        $documentTemplate = $this->getDocumentTemplate();
        $documentTemplate->JScode = GeneralUtility::wrapJS('
				function closing() {	//
					close();
				}
				function setParams(mode,params) {	//
					parent.content.location.href = ' . GeneralUtility::quoteJSvalue($moduleUrl) . '+mode+"&bparams="+params;
				}
				if (!window.opener) {
					alert("ERROR: Sorry, no link to main window... Closing");
					close();
				}
		');
        // build the header part
        $documentTemplate->startPage($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:TYPO3_Element_Browser'));
        // URL for the inner main frame:
        $url = $moduleUrl . rawurlencode($mode) . '&bparams=' . rawurlencode($bparams);
        // Create the frameset for the window
        // Formerly there were a ' onunload="closing();"' in the <frameset> tag - but it failed on Safari browser on Mac unless the handler was "onUnload"
        $this->content = $this->getPageRenderer()->render(PageRenderer::PART_HEADER) . '<frameset rows="*,1" framespacing="0" frameborder="0" border="0">
				<frame name="content" src="' . htmlspecialchars($url) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" />
				<frame name="menu" src="' . htmlspecialchars(BackendUtility::getModuleUrl('dummy')) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />
			</frameset>
		</html>
		';
    }
Ejemplo n.º 8
0
    /**
     * Return JS configuration of the htmlArea plugins registered by the extension
     *
     * @param string $rteNumberPlaceholder A dummy string for JS arrays
     * @return string JS configuration for registered plugins, in this case, JS configuration of block elements
     */
    public function buildJavascriptConfiguration($rteNumberPlaceholder)
    {
        $registerRTEinJavascriptString = '';
        $button = 'link';
        if (in_array($button, $this->toolbar)) {
            if (!is_array($this->thisConfig['buttons.']) || !is_array($this->thisConfig['buttons.'][$button . '.'])) {
                $registerRTEinJavascriptString .= '
			RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . ' = new Object();';
            }
            $registerRTEinJavascriptString .= '
			RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . '.pathLinkModule = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('rtehtmlarea_wizard_browse_links')) . ';';
            if ($this->htmlAreaRTE->is_FE()) {
                $RTEProperties = $this->htmlAreaRTE->RTEsetup;
            } else {
                $RTEProperties = $this->htmlAreaRTE->RTEsetup['properties'];
            }
            if (is_array($RTEProperties['classesAnchor.'])) {
                $registerRTEinJavascriptString .= '
			RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . '.classesAnchorUrl = "' . $this->htmlAreaRTE->writeTemporaryFile('classesAnchor_' . $this->htmlAreaRTE->contentLanguageUid, 'js', $this->buildJSClassesAnchorArray()) . '";';
            }
            $registerRTEinJavascriptString .= '
			RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . '.additionalAttributes = "data-htmlarea-external' . ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extensionKey]['plugins'][$this->pluginName]['additionalAttributes'] ? ',' . $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extensionKey]['plugins'][$this->pluginName]['additionalAttributes'] : '') . '";';
        }
        return $registerRTEinJavascriptString;
    }
Ejemplo n.º 9
0
 /**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $documentTranslation = $arguments['documentTranslation'];
     $icons = array('html' => '<a class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</a>', 'pdf' => '<a class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</a>', 'sxw' => '<a class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</a>');
     $formats = $documentTranslation->getFormats();
     foreach ($formats as $format) {
         $output = '';
         /** @var \TYPO3\CMS\Documentation\Domain\Model\DocumentFormat $format */
         $output .= '<a ';
         $uri = '../' . $format->getPath();
         $extension = substr($uri, strrpos($uri, '.') + 1);
         if (strlen($extension) < 5) {
             // This is direct link to a file
             $output .= 'href="' . $uri . '" class="btn btn-default"';
         } else {
             $extension = $format->getFormat();
             if ($extension === 'json') {
                 $extension = 'js';
             }
             $output .= 'href="#" onclick="top.TYPO3.Backend.ContentContainer.setUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($uri) . ')" class="btn btn-default"';
         }
         $xliff = 'LLL:EXT:documentation/Resources/Private/Language/locallang.xlf';
         $title = sprintf($GLOBALS['LANG']->sL($xliff . ':tx_documentation_domain_model_documentformat.format.title'), $format->getFormat());
         $output .= ' title="' . htmlspecialchars($title) . '">';
         $spriteIconHtml = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForFile($extension);
         $output .= $spriteIconHtml . '</a>' . LF;
         $keyFormat = $format->getFormat();
         if ($keyFormat === 'json') {
             // It should take over the place of sxw which will then never be used
             $keyFormat = 'sxw';
         }
         $icons[$keyFormat] = $output;
     }
     return implode('', array_values($icons));
 }
Ejemplo n.º 10
0
    /**
     * Queries a table for records and completely processes them
     *
     * Returns a two-dimensional array of almost finished records;
     * they only need to be put into a <li>-structure
     *
     * @param array $params
     * @param integer $recursionCounter recursion counter
     * @return mixed array of rows or FALSE if nothing found
     */
    public function queryTable(&$params, $recursionCounter = 0)
    {
        $uid = (int) GeneralUtility::_GP('uid');
        $records = parent::queryTable($params, $recursionCounter);
        $table = $this->config['currentTable'];
        if ($this->checkIfTagIsNotFound($records)) {
            $text = $params['value'];
            $javaScriptCode = '
var value=' . GeneralUtility::quoteJSvalue($text) . ';

Ext.Ajax.request({
	url : \'ajax.php\' ,
	params : { ajaxID:\'TagItems::createTag\', item:value, table:\'' . htmlspecialchars($table) . '\', uid:\'' . $uid . '\' },
	success: function ( result, request ) {
		var arr = result.responseText.split(\'-\');
		setFormValueFromBrowseWin(arr[5], arr[2] +  \'_\' + arr[0], arr[1]);
		TBE_EDITOR.fieldChanged(arr[3], arr[6], arr[4], arr[5]);
	},
	failure: function ( result, request) {
		Ext.MessageBox.alert(\'Failed\', result.responseText);
	}
});
';
            $javaScriptCode = trim(str_replace('"', '\'', $javaScriptCode));
            $link = implode(' ', explode(chr(10), $javaScriptCode));
            $records['tx_tagitems_domain_model_tag_' . strlen($text)] = array('text' => '<div onclick="' . $link . '">
							<span class="suggest-path">
								<a>' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:tag_items/Resources/Private/Language/locallang_db.xlf:tag_suggest'), htmlspecialchars($text)) . '</a>
							</span></div>', 'table' => 'tx_tagitems_domain_model_tag', 'class' => 'suggest-noresults', 'style' => 'background-color:#E9F1FE !important;background-image:url(' . $this->getDummyIconPath() . ');');
        }
        return $records;
    }
Ejemplo n.º 11
0
    /**
     * Queries a table for records and completely processes them
     *
     * Returns a two-dimensional array of almost finished records;
     * they only need to be put into a <li>-structure
     *
     * @param array $params
     * @param int $recursionCounter recursion counter
     * @return mixed array of rows or FALSE if nothing found
     */
    public function queryTable(&$params, $recursionCounter = 0)
    {
        $uid = (int) GeneralUtility::_GP('uid');
        $records = parent::queryTable($params, $recursionCounter);
        if ($this->checkIfTagIsNotFound($records)) {
            $text = GeneralUtility::quoteJSvalue($params['value']);
            $javaScriptCode = '
var value=' . $text . ';

Ext.Ajax.request({
	url : \'ajax.php\' ,
	method: "GET",
	params : { ajaxID : \'News::createTag\', item:value,newsid:\'' . $uid . '\' },
	success: function ( result, request ) {
		var arr = result.responseText.split(\'-\');
		setFormValueFromBrowseWin(arr[5], arr[2] +  \'_\' + arr[0], arr[1]);
		TBE_EDITOR.fieldChanged(arr[3], arr[6], arr[4], arr[5]);
	},
	failure: function ( result, request) {
		Ext.MessageBox.alert(\'Failed\', result.responseText);
	}
});
';
            $javaScriptCode = trim(str_replace('"', '\'', $javaScriptCode));
            $link = implode(' ', explode(LF, $javaScriptCode));
            $records['tx_news_domain_model_tag_' . strlen($text)] = ['text' => '<div onclick="' . $link . '">
							<span class="suggest-path">
								<a>' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:tag_suggest'), $text) . '</a>
							</span></div>', 'table' => 'tx_news_domain_model_tag', 'class' => 'suggest-noresults', 'icon' => $this->getDummyIcon()->render()];
        }
        return $records;
    }
Ejemplo n.º 12
0
 /**
  * Render OpenID identifier field for user setup
  *
  * @return string HTML input field to change the OpenId
  */
 public function renderOpenID()
 {
     $openid = $this->getBackendUser()->user['tx_openid_openid'];
     $add = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:addopenid'));
     $parameters = ['P[itemName]' => 'data[be_users][tx_openid_openid]'];
     $popUpUrl = GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('wizard_openid', $parameters));
     return '<div class="input-group">' . '<input id="field_tx_openid_openid"' . ' class="form-control"' . ' type="text" name="data[be_users][tx_openid_openid]"' . ' value="' . htmlspecialchars($openid) . '" />' . '<div class="input-group-addon">' . '<a href="#" onclick="' . 'vHWin=window.open(' . $popUpUrl . ',null,\'width=800,height=600,status=0,menubar=0,scrollbars=0\');' . 'vHWin.focus();return false;' . '">' . '<img src="../typo3/sysext/openid/ext_icon_small.png" alt="' . $add . '" title="' . $add . '"/>' . '</a>' . '</div>' . '</div>';
 }
 /**
  * Render confirm link with sprite icon
  *
  * @param string $link
  * @param string $message
  * @param string $title
  * @param string $class
  * @param string $icon
  * @return string
  */
 public function render($link, $message = '', $title = '', $class = '', $icon = 'actions-edit-delete')
 {
     if (!empty($link)) {
         $attributes = array('href' => $link, 'onclick' => 'return confirm(' . GeneralUtility::quoteJSvalue($message) . ')', 'title' => $title, 'class' => $class);
         return '<a ' . GeneralUtility::implodeAttributes($attributes, false, true) . '>' . IconUtility::getSpriteIcon($icon) . '</a>';
     }
     return '';
 }
 /**
  * Create on-click event value.
  *
  * @param array $row The record.
  * @param string $vv Column position value.
  * @param int $moveUid Move uid
  * @param int $pid PID value.
  * @param int $sys_lang System language
  * @return string
  */
 public function onClickInsertRecord($row, $vv, $moveUid, $pid, $sys_lang = 0)
 {
     if (is_array($row)) {
         $location = $GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => 'tt_content:new/-' . $row['uid'] . '/' . $row['colPos']));
     } else {
         $location = $GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => 'tt_content:new/' . $pid . '/' . $vv));
     }
     return 'jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($location) . ');return false;';
 }
Ejemplo n.º 15
0
	/**
	 * Wrapping the title in a link, if applicable.
	 *
	 * @param string $title Title, ready for output.
	 * @param array $v The record
	 * @param bool $ext_pArrPages If set, pages clicked will return immediately, otherwise reload page.
	 * @return string Wrapping title string.
	 */
	public function wrapTitle($title, $v, $ext_pArrPages) {
		if ($ext_pArrPages) {
			$ficon = \TYPO3\CMS\Backend\Utility\IconUtility::getIcon('pages', $v);
			$onClick = 'return insertElement(\'pages\', \'' . $v['uid'] . '\', \'db\', ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($v['title']) . ', \'\', \'\', \'' . $ficon . '\',\'\',1);';
		} else {
			$onClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['uid']) . ');';
		}
		return '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $title . '</a>';
	}
 /**
  * Wrapping the title in a link, if applicable.
  *
  * @param string $title Title, ready for output.
  * @param \TYPO3\CMS\Core\Resource\Folder $folderObject The folderObject 'record'
  *
  * @return string Wrapping title string.
  */
 public function wrapTitle($title, $folderObject)
 {
     if ($this->ext_isLinkable($folderObject)) {
         $aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier())) . ');';
         return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
     } else {
         return '<span class="typo3-dimmed">' . $title . '</span>';
     }
 }
Ejemplo n.º 17
0
 /**
  * Render link with sprite icon to remove user
  *
  * @param \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser Target backendUser to switch active session to
  * @return string
  */
 public function render(\TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser)
 {
     if ($backendUser->getUid() == $GLOBALS['BE_USER']->user['uid']) {
         return '';
     }
     $redirectUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI');
     $parameters = 'cmd[be_users][' . $backendUser->getUid() . '][delete]=1';
     $url = $GLOBALS['BACK_PATH'] . 'tce_db.php?&' . $parameters . '&redirect=' . ($redirectUrl == '' ? '\' + T3_THIS_LOCATION + \'' : rawurlencode($redirectUrl)) . '&vC=' . rawurlencode($GLOBALS['BE_USER']->veriCode()) . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '&prErr=1&uPT=1';
     return '<a href="' . $url . '"  onclick="return confirm(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('confirm', 'beuser', array($backendUser->getUserName()))) . ')">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
 }
 /**
  * Wrap the plus/minus icon in a link
  *
  * @param string $icon HTML string to wrap, probably an image tag.
  * @param string $cmd Command for 'PM' get var
  * @param bool $bMark If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
  * @return string Link-wrapped input string
  * @access private
  */
 public function PM_ATagWrap($icon, $cmd, $bMark = '')
 {
     $name = $anchor = '';
     if ($bMark) {
         $anchor = '#' . $bMark;
         $name = ' name="' . $bMark . '"';
     }
     $aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'PM=' . $cmd) . ',' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($anchor) . ');';
     return '<a href="#"' . htmlspecialchars($name) . ' onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
 }
 /**
  * Create on-click event value.
  *
  * @param array $row The record.
  * @param string $vv Column position value.
  * @param int $moveUid Move uid
  * @param int $pid PID value.
  * @param int $sys_lang System language
  * @return string
  */
 public function onClickInsertRecord($row, $vv, $moveUid, $pid, $sys_lang = 0)
 {
     if (is_array($row)) {
         $linkInformation = 'tt_content:new/-' . $row['uid'] . '/' . $row['colPos'];
     } else {
         $linkInformation = 'tt_content:new/' . $pid . '/' . $vv;
     }
     $location = $this->linkToCurrentModule(['edit_record' => $linkInformation]);
     return 'jumpToUrl(' . GeneralUtility::quoteJSvalue($location) . ');return false;';
 }
Ejemplo n.º 20
0
 /**
  * Modifies edit icon array
  *
  * @param array $cells Array of edit icons
  * @param \TYPO3\CMS\Filelist\FileList $parentObject Parent object
  * @return void
  */
 public function manipulateEditIcons(&$cells, &$parentObject)
 {
     /** @var \TYPO3\CMS\Core\Resource\File $file */
     $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
     $fullIdentifier = $cells['__fileOrFolderObject']->getPublicUrl();
     if ($cells['__fileOrFolderObject'] instanceof \TYPO3\CMS\Core\Resource\File) {
         $url = BackendUtility::getModuleUrl('file_CsCdnCdn', array('target' => $fullIdentifier));
         $renameOnClick = 'top.content.list_frame.location.href = ' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
         $cells['cdn'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($renameOnClick) . '"  title="CDN"> ' . $iconFactory->getIcon('tx-cscdn-replace', Icon::SIZE_SMALL)->render() . '</a>';
     }
 }
Ejemplo n.º 21
0
 /**
  * Return JS configuration of the htmlArea plugins registered by the extension
  *
  * @return string JS configuration for registered plugins, in this case, JS configuration of block elements
  */
 public function buildJavascriptConfiguration()
 {
     $jsArray = [];
     $button = 'user';
     if (in_array($button, $this->toolbar)) {
         if (!is_array($this->configuration['thisConfig']['buttons.']) || !is_array($this->configuration['thisConfig']['buttons.'][$button . '.'])) {
             $jsArray[] = 'RTEarea[editornumber].buttons.' . $button . ' = new Object();';
         }
         $jsArray[] = 'RTEarea[editornumber].buttons.' . $button . '.pathUserModule = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('rtehtmlarea_wizard_user_elements')) . ';';
     }
     return implode(LF, $jsArray);
 }
Ejemplo n.º 22
0
 /**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     /** @var \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser */
     $backendUser = $arguments['backendUser'];
     /** @var BackendUserAuthentication $beUser */
     $beUser = $GLOBALS['BE_USER'];
     if ($backendUser->getUid() === (int) $beUser->user['uid']) {
         return '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>';
     }
     $urlParameters = ['cmd[be_users][' . $backendUser->getUid() . '][delete]' => 1, 'vC' => $beUser->veriCode(), 'prErr' => 1, 'uPT' => 1, 'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI')];
     $url = BackendUtility::getModuleUrl('tce_db', $urlParameters) . BackendUtility::getUrlToken('tceAction');
     return '<a class="btn btn-default" href="' . htmlspecialchars($url) . '"  onclick="return confirm(' . GeneralUtility::quoteJSvalue(LocalizationUtility::translate('confirm', 'beuser', array($backendUser->getUserName()))) . ')">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
 }
Ejemplo n.º 23
0
 /**
  * Return JS configuration of the htmlArea plugins registered by the extension
  *
  * @return string JS configuration for registered plugins, in this case, JS configuration of block elements
  */
 public function buildJavascriptConfiguration()
 {
     $jsArray = array();
     $button = 'cleanword';
     if (in_array($button, $this->toolbar)) {
         if (!is_array($this->configuration['thisConfig']['buttons.']) || !is_array($this->configuration['thisConfig']['buttons.'][$button . '.'])) {
             $jsArray[] = 'RTEarea[editornumber].buttons.' . $button . ' = new Object();';
         }
         $jsArray[] = 'RTEarea[editornumber].buttons.' . $button . '.pathParseHtmlModule = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('rtehtmlarea_wizard_parse_html')) . ';';
         $jsArray[] = 'RTEarea[editornumber].buttons.' . $button . '.hotKey = "' . ($this->configuration['thisConfig']['enableWordClean.']['hotKey'] ?: '0') . '";';
     }
     return implode(LF, $jsArray);
 }
 /**
  * Wrapping the title in a link, if applicable.
  *
  * @param string $title Title, ready for output.
  * @param array $v The record
  * @param bool $ext_pArrPages If set, pages clicked will return immediately, otherwise reload page.
  * @return string Wrapping title string.
  */
 public function wrapTitle($title, $v, $ext_pArrPages = false)
 {
     if ($ext_pArrPages && $v['uid']) {
         $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
         $ficon = $iconFactory->getIconForRecord('pages', $v, Icon::SIZE_SMALL)->render();
         $out = '<span data-uid="' . htmlspecialchars($v['uid']) . '" data-table="pages" data-title="' . htmlspecialchars($v['title']) . '" data-icon="' . htmlspecialchars($ficon) . '">';
         $out .= '<a href="#" data-close="1">' . $title . '</a>';
         $out .= '</span>';
         return $out;
     }
     $parameters = GeneralUtility::implodeArrayForUrl('', $this->linkParameterProvider->getUrlParameters(['pid' => $v['uid']]));
     return '<a href="#" onclick="return jumpToUrl(' . htmlspecialchars(GeneralUtility::quoteJSvalue($this->getThisScript() . ltrim($parameters, '&'))) . ');">' . $title . '</a>';
 }
Ejemplo n.º 25
0
 /**
  * Wrapping the image tag, $icon, for the row, $row (except for mount points)
  *
  * @param string $icon The image tag for the icon
  * @param array $row The row for the current element
  * @return string The processed icon input value.
  * @access private
  */
 public function wrapIcon($icon, $row)
 {
     // Add title attribute to input icon tag
     $theIcon = $this->addTagAttributes($icon, $this->titleAttrib ? $this->titleAttrib . '="' . $this->getTitleAttrib($row) . '"' : '');
     // Wrap icon in click-menu link.
     if (!$this->ext_IconMode) {
         $theIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($theIcon, $this->treeName, $this->getId($row), 0);
     } elseif ($this->ext_IconMode === 'titlelink') {
         $aOnClick = 'return jumpTo(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getJumpToParam($row)) . ',this,' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->domIdPrefix . $this->getId($row)) . ',' . $this->bank . ');';
         $theIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $theIcon . '</a>';
     }
     return $theIcon;
 }
Ejemplo n.º 26
0
    /**
     * Return JS configuration of the htmlArea plugins registered by the extension
     *
     * @param string $rteNumberPlaceholder A dummy string for JS arrays
     * @return string JS configuration for registered plugins, in this case, JS configuration of block elements
     */
    public function buildJavascriptConfiguration($rteNumberPlaceholder)
    {
        $registerRTEinJavascriptString = '';
        $button = 'user';
        if (in_array($button, $this->toolbar)) {
            if (!is_array($this->thisConfig['buttons.']) || !is_array($this->thisConfig['buttons.'][$button . '.'])) {
                $registerRTEinJavascriptString .= '
			RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . ' = new Object();';
            }
            $registerRTEinJavascriptString .= '
			RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . '.pathUserModule = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('rtehtmlarea_wizard_user_elements')) . ';';
        }
        return $registerRTEinJavascriptString;
    }
Ejemplo n.º 27
0
    /**
     * Create the page navigation tree in HTML
     *
     * @param array|string $treeArr 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 ($this->linkParameterProvider->curUrlInfo['act'] === 'page' && $this->linkParameterProvider->curUrlInfo['pageid'] == $treeItem['row']['uid'] && $this->linkParameterProvider->curUrlInfo['pageid']) {
                $selected = ' bg-success';
            }
            $aOnClick = 'return jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $this->linkParameterProvider->act . '&editorNo=' . $this->linkParameterProvider->editorNo . '&contentTypo3Language=' . $this->linkParameterProvider->contentTypo3Language . '&mode=' . $this->linkParameterProvider->mode . '&expandPage=' . $treeItem['row']['uid']) . ');';
            $cEbullet = $this->ext_isLinkable($treeItem['row']['doktype'], $treeItem['row']['uid']) ? '<a href="#" class="pull-right" onclick="' . htmlspecialchars($aOnClick) . '"><i class="fa fa-caret-square-o-right"></i></a>' : '';
            $out .= '
				<li' . ($classAttr ? ' class="' . trim($classAttr) . '"' : '') . '>
					<span class="list-tree-group' . $selected . '">
						' . $cEbullet . '
						<span class="list-tree-icon">' . $treeItem['HTML'] . '</span>
						' . $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>';
                }
            }
        }
        return '<ul class="list-tree list-tree-root">' . $out . '</ul>';
    }
Ejemplo n.º 28
0
 /**
  * Wrapping the title in a link, if applicable.
  *
  * @param string $title Title, ready for output.
  * @param Folder $folderObject The "record"
  * @return string Wrapping title string.
  */
 public function wrapTitle($title, Folder $folderObject)
 {
     if ($this->ext_isLinkable($folderObject)) {
         $parameters = 'act=' . $this->linkParameterProvider->act . '&mode=' . $this->linkParameterProvider->mode . '&editorNo=' . $this->linkParameterProvider->editorNo . '&expandFolder=' . $this->getJumpToParam($folderObject);
         if ($this->linkParameterProvider instanceof SelectImage && $this->linkParameterProvider->sys_language_content) {
             $parameters .= '&sys_language_content=' . $this->linkParameterProvider->sys_language_content;
         }
         if ($this->linkParameterProvider instanceof BrowseLinks && $this->linkParameterProvider->contentTypo3Language) {
             $parameters .= '&contentTypo3Language=' . $this->linkParameterProvider->contentTypo3Language;
         }
         $aOnClick = 'return jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . $parameters) . ');';
         return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
     }
     return '<span class="text-muted">' . $title . '</span>';
 }
Ejemplo n.º 29
0
 /**
  * Wrap the plus/minus icon in a link
  *
  * @param string $icon HTML string to wrap, probably an image tag.
  * @param string $cmd Command for 'PM' get var
  * @param boolean $isExpand If expanded
  * @return string Link-wrapped input string
  * @access private
  */
 public function PMiconATagWrap($icon, $cmd, $isExpand = TRUE)
 {
     if (empty($this->scope)) {
         $this->scope = array('class' => get_class($this), 'script' => $this->thisScript, 'ext_noTempRecyclerDirs' => $this->ext_noTempRecyclerDirs, 'browser' => array('mode' => $GLOBALS['SOBE']->browser->mode, 'act' => $GLOBALS['SOBE']->browser->act, 'editorNo' => $GLOBALS['SOBE']->browser->editorNo));
     }
     if ($this->thisScript) {
         // Activates dynamic AJAX based tree
         $scopeData = serialize($this->scope);
         $scopeHash = GeneralUtility::hmac($scopeData);
         $js = htmlspecialchars('Tree.load(' . GeneralUtility::quoteJSvalue($cmd) . ', ' . (int) $isExpand . ', this, ' . GeneralUtility::quoteJSvalue($scopeData) . ', ' . GeneralUtility::quoteJSvalue($scopeHash) . ');');
         return '<a class="pm" onclick="' . $js . '">' . $icon . '</a>';
     } else {
         return $icon;
     }
 }
Ejemplo n.º 30
0
    /**
     * Return JS configuration of the htmlArea plugins registered by the extension
     *
     * @param string $rteNumberPlaceholder A dummy string for JS arrays
     * @return string JS configuration for registered plugins, in this case, JS configuration of block elements
     */
    public function buildJavascriptConfiguration($rteNumberPlaceholder)
    {
        $registerRTEinJavascriptString = '';
        $button = 'cleanword';
        if (in_array($button, $this->toolbar)) {
            if (!is_array($this->thisConfig['buttons.']) || !is_array($this->thisConfig['buttons.'][$button . '.'])) {
                $registerRTEinJavascriptString .= '
			RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . ' = new Object();';
            }
            $registerRTEinJavascriptString .= '
			RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . '.pathParseHtmlModule = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('rtehtmlarea_wizard_parse_html')) . ';
			RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . '.hotKey = "' . ($this->thisConfig['enableWordClean.']['hotKey'] ?: '0') . '";';
        }
        return $registerRTEinJavascriptString;
    }