Index: t3lib/class.t3lib_befunc.php =================================================================== --- t3lib/class.t3lib_befunc.php (Revision 8878) +++ t3lib/class.t3lib_befunc.php (Arbeitskopie) @@ -2487,15 +2487,12 @@ * @return string HTML content for a help icon/text */ public static function helpTextIcon($table, $field, $BACK_PATH, $force = 0) { - global $TCA_DESCR, $BE_USER; - - $onClick = 'vHWin=window.open(\''.$BACK_PATH.'view_help.php?tfID='.($table.'.'.$field).'\',\'viewFieldHelp\',\'height=400,width=600,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;'; - if (is_array($TCA_DESCR[$table]) && is_array($TCA_DESCR[$table]['columns'][$field]) && (isset($BE_USER->uc['edit_showFieldHelp']) || $force)) { - if ($BE_USER->uc['edit_showFieldHelp'] == 'icon') { + if (is_array($GLOBALS['TCA_DESCR'][$table]) && is_array($GLOBALS['TCA_DESCR'][$table]['columns'][$field]) && (isset($GLOBALS['BE_USER']->uc['edit_showFieldHelp']) || $force)) { + if ($GLOBALS['BE_USER']->uc['edit_showFieldHelp'] == 'icon') { $text = self::helpText($table, $field, $BACK_PATH, ''); $text = '' . $GLOBALS['LANG']->hscAndCharConv($text, FALSE) . ''; } - return '' . t3lib_iconWorks::getSpriteIcon('actions-system-help-open', array('class' => 'typo3-csh-icon')) . $text.''; + return '' . t3lib_iconWorks::getSpriteIcon('actions-system-help-open', array('class' => 'typo3-csh-icon')) . $text . ''; } } Index: typo3/js/common.js =================================================================== --- typo3/js/common.js (Revision 8878) +++ typo3/js/common.js (Arbeitskopie) @@ -24,7 +24,7 @@ // Please make sure that prototype.js is loaded before loading this // file in your script, the responder is only added if prototype was loaded -if (Prototype) { +if (typeof Prototype != 'undefined') { // adding generic a responder to use when a AJAX request is done Ajax.Responders.register({ onCreate: function(request, transport) { @@ -100,3 +100,22 @@ } } }; + +/** opens up a popup window with the context sensitive help + * the CSH link (created in t3lib_befunc::helpTextIcon) includes a rel="table|field" + * value, the backpath is set in typo3/template.php::getHelptextCode() + */ +TYPO3.Help = { + backPath: '', + popupUrl: 'view_help.php?tfID=', + openPopup: function(anchorEl) { + var data = anchorEl.getAttribute('rel').split('|'); + var table = data[0]; + var field = data[1]; + window.open(this.backPath + this.popupUrl + table + '.' + field, 'viewFieldHelp', 'height=400,width=600,status=0,menubar=0,scrollbars=1').focus(); + return false; + } +}; + + + Index: typo3/template.php =================================================================== --- typo3/template.php (Revision 8878) +++ typo3/template.php (Arbeitskopie) @@ -743,6 +743,9 @@ if (!$GLOBALS['BE_USER']->uc['disableTabInTextarea']) { $this->loadJavascriptLib('tab.js'); } + + // include the JS for the Context sensitive help + $this->getHelptextCode(); // Get the browser info $browserInfo = t3lib_utility_Client::getBrowserInfo(t3lib_div::getIndpEnv('HTTP_USER_AGENT')); @@ -1562,6 +1565,28 @@ /** + * This loads everything needed for the CSH (help system) + * + * @return void + */ + protected function getHelptextCode() { + $this->pageRenderer->addJsFile($this->backPath . 'js/common.js'); + $this->pageRenderer->loadExtJS(); + $this->pageRenderer->addExtOnReadyCode(' + if (typeof TYPO3.Help != "undefined") { + TYPO3.Help.backPath = "' . $this->backPath . '"; + var itms = Ext.DomQuery.select("a.typo3-csh-link"); + if (itms && itms.length) { + itms.each(function(el) { + Ext.get(el).on("click", function(evt) { TYPO3.Help.openPopup(el); evt.stopEvent(); }); + }); + } + } + '); + } + + + /** * Creates a tab menu from an array definition * * Returns a tab menu for a module