Project

General

Profile

Feature #20726 » 11487_befunc_helptexticon.diff

Administrator Admin, 2009-07-07 00:15

View differences:

t3lib/class.t3lib_befunc.php (working copy)
* @return string HTML content for a help icon/text
*/
public static function helpTextIcon($table, $field, $BACK_PATH, $force = 0) {
global $TCA_DESCR, $BE_USER;
global $TCA_DESCR, $BE_USER, $BACK_PATH;
$width = is_array($GLOBALS['TYPO3_CONF_VARS']['BE']['popupDimensions']['inlineHelp']) ? $GLOBALS['TYPO3_CONF_VARS']['BE']['popupDimensions']['inlineHelp'][0] : 400;
$height = is_array($GLOBALS['TYPO3_CONF_VARS']['BE']['popupDimensions']['inlineHelp']) ? $GLOBALS['TYPO3_CONF_VARS']['BE']['popupDimensions']['inlineHelp'][1] : 300;
if (is_object($GLOBALS['SOBE'])) {
$doc =& $GLOBALS['SOBE']->doc;
} else {
$doc =& $GLOBALS['TBE_TEMPLATE'];
}
if (is_object($doc)) {
$doc->loadExtJs();
$doc->loadJavascriptLib('js/extjs/ux/iframewindow.js');
$doc->JScodeArray['registerWindowWithHelpLinks'] = 'Ext.onReady=function(){
Ext.namespace("TYPO3");
TYPO3.lang = {
inlineHelpTitle : "' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_view_help.xml:title')) . '",
openInNewWindow: "' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.openInNewWindow')) . '"
};
Ext.ux.IframeWindow.register("a.typo3-csh-link", ' . $width .', ' . $height . ');
}';
$href = $BACK_PATH . 'view_help.php?tfID=' . ($table . '.' . $field);
$onClick = '';
} else {
#TODO examine why it's not available
$href = '#';
$onClick = ' onclick="vHWin=window.open(\''.$BACK_PATH.'view_help.php?tfID='.($table.'.'.$field).'\',\'viewFieldHelp\',\'height=' . $height . ',width=' . $width . ',status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;"';
}
$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') {
$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="' . $href . '"' . $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>';
}
}
t3lib/config_default.php (working copy)
'WorkspaceMenu::toggleWorkspacePreview' => 'typo3/classes/class.workspaceselector.php:WorkspaceSelector->toggleWorkspacePreview',
'WorkspaceMenu::setWorkspace' => 'typo3/classes/class.workspaceselector.php:WorkspaceSelector->setWorkspace'
),
'popupDimensions' => array( // Default values for popup windows, each as array(width, height)
'inlineHelp' => array(400, 300),
),
'XCLASS' => Array(), // See 'Inside TYPO3' document for more information.
),
'FE' => Array( // Configuration for the TypoScript frontend (FE). Nothing here relates to the administration backend!
typo3/js/extjs/ux/iframewindow.js (revision 0)
/***************************************************************
* Copyright notice
*
* (c) 2009 Steffen Kamper <info@sk-typo3.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* ExtJS Windows for open URLs instead of popup
* register sample:
* Ext.ux.IframeWindow.register("a.typo3-csh-link", 400, 300);
*/
Ext.ns('Ext.ux');
Ext.ux.IframeWindow = (function(){
var win,
initialized = false,
windowId,
selectors = [];
return {
register: function(sel, width, height) {
if(selectors.indexOf(sel) === -1) {
selectors.push(sel);
Ext.fly(document).on('click', function(ev){
var target = ev.getTarget(sel);
if (target) {
ev.preventDefault();
this.open(target, sel, width, height);
}
}, this);
}
},
open: function(target, sel, w, h, t) {
var id = Ext.id();
var frame = document.createElement('iframe');
frame.id = id;
frame.name = id;
frame.frameBorder = '0';
frame.width = '100%';
frame.height = '100%';
frame.src = target;
win = new Ext.Window ({
width: w,
height: h,
maximizable: true,
html: '',
title: TYPO3.lang.inlineHelpTitle,
buttonAlign: 'right',
buttons: [
new Ext.Button({
text: TYPO3.lang.openInNewWindow,
handler: function(){
var windowId = Ext.id();
window.open(target, windowId);
}
})
]
});
win.on('close', function() {
if(Ext.isIE) {
win.body.dom.firstChild.src = "";
}
}, win);
win.on('show', function() {
}, win);
win.show();
win.body.appendChild(frame);
// Seems to be workaround for IE having name readonly.
if(Ext.isIE) {
document.frames[id].name = id;
}
},
}
})();
(2-2/2)