Project

General

Profile

Bug #22619 ยป uxw_cleanup_csh_code_v2.patch

Administrator Admin, 2010-05-10 01:56

View differences:

t3lib/class.t3lib_befunc.php (Arbeitskopie)
* @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 = t3lib_BEfunc::helpText($table, $field, $BACK_PATH, '');
$text = '<span class="typo3-csh-inline">'.$GLOBALS['LANG']->hscAndCharConv($text, false).'</span>';
}
return '<a class="typo3-csh-link" href="#" onclick="'.htmlspecialchars($onClick).'"><img'.t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/helpbubble.gif', 'width="14" height="14"').' hspace="2" border="0" class="typo3-csh-icon" alt="" />'.$text.'</a>';
return '<a class="typo3-csh-link" href="" rel="' . $table . '|' . $field . '"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/helpbubble.gif', 'width="14" height="14"') . ' hspace="2" border="0" class="typo3-csh-icon" alt="" />' . $text . '</a>';
}
}
typo3/js/common.js (Arbeitskopie)
// 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) {
......
}
}
};
/** 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;
}
};
typo3/template.php (Arbeitskopie)
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'));
......
/**
* 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
    (1-1/1)