Project

General

Profile

Bug #23788 » 16059.diff

Administrator Admin, 2010-10-19 16:05

View differences:

t3lib/class.t3lib_befunc.php (working copy)
$helpText = '<div class="t3-help-inline">' . $helpText . '</div>';
$text = '<abbr class="t3-help-teaser">' . $text . '</abbr>';
$text = '<a class="t3-help-link" href="#" rel="' . $table . '|' . $field . '">' . $text . $helpText . '</a>';
$text = '<a class="t3-help-link" href="#" data-table="' . $table . '" data-field="' . $field . '">' . $text . '</a>';
}
return $text;
}
t3lib/config_default.php (working copy)
'default' => 't3lib/class.t3lib_frontendedit.php:t3lib_frontendedit'
)
),
'ExtDirect' => array(), // array of key value pairs (provider -> location:className) that holds the classes for the ExtDirect functionality
'ExtDirect' => array(
'TYPO3.CSH.ExtDirect' => 't3lib/extjs/dataprovider/class.extdirect_dataprovider_contexthelp.php:extDirect_DataProvider_ContextHelp'
), // array of key value pairs (provider -> location:className) that holds the classes for the ExtDirect functionality
),
'EXTCONF' => array( // Here you may add manually set configuration options for your extensions. Eg. $TYPO3_CONF_VARS['EXTCONF']['my_extension_key']['my_option'] = 'my_value';
// '--key--' => array()
t3lib/extjs/dataprovider/class.extdirect_dataprovider_contexthelp.php (revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2010 Steffen Kamper <steffen@typo3.org>
* 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!
***************************************************************/
/**
* ExtDirect DataProvider for ContextHelp
*/
class extDirect_DataProvider_ContextHelp {
/**
* Fetch the context help for the given table/field parameters
*
* @param string $table table identifier
* @param string $field filed identifier
* @return array complete help information
*/
public function getContextHelp($table, $field) {
global $TCA_DESCR;
if (!isset($TCA_DESCR[$table]['columns'])) {
$GLOBALS['LANG']->loadSingleTableDescription($table);
}
$data =$TCA_DESCR[$table]['columns'][$field];
// add see also arrow
if ($data['image_descr'] || $data['seeAlso'] || $data['details'] || $data['syntax']) {
$arrow = t3lib_iconWorks::getSpriteIcon('actions-view-go-forward');
}
// add description text
if ($data['description'] || $arrow) {
$description = '<p class="t3-help-short">' . nl2br(htmlspecialchars($data['description'])) . $arrow . '</p>';
}
$title = $data['alttitle'] ? $data['alttitle'] : $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_view_help.xml:title');
return array(
'title' => $title,
'description' => $description,
'id' => $table . '.' . $field,
);
}
}
t3lib/js/extjs/contexthelp.js (revision 0)
/***************************************************************
* Copyright notice
*
* (c) 2010 Steffen Kamper <steffen@typo3.org>
* 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!
***************************************************************/
Ext.ns('TYPO3', 'TYPO3.CSH.ExtDirect');
/**
* Class to show tooltips for links that have the css t3-help-link
* need the tags data-table and data-field (HTML5)
*/
TYPO3.ContextHelp = function() {
/**
* Tooltip
* @type {Ext.ToolTip}
*/
var tip;
/**
* Cache for CSH
* @type {Ext.util.MixedCollection}
*/
var cshHelp = new Ext.util.MixedCollection(true);
return {
/**
* Constructor
*/
init: function() {
tip = new Ext.ToolTip({
title: 'TYPO3 CSH',
html: 'A very simple tooltip',
anchorToTarget: true,
//anchorOffset: 10,
width: 140,
renderTo: Ext.getBody(),
cls: 'typo3-csh-tooltip',
dismissDelay: 3000, // auto hide after 3 seconds
showsDelay: 2000, // show after 2 seconds
listeners: {
'render': function(){
this.body.on('click', function(e){
e.stopEvent();
top.TYPO3.ContextHelpWindow.open(this.cshLink);
}, this, {delegate:'span.t3-icon-view-go-forward'});
}
}
});
Ext.select('div').on('mouseover', TYPO3.ContextHelp.showToolTipHelp, TYPO3.ContextHelp, {delegate: 'a.t3-help-link'});
Ext.select('div').on('click', TYPO3.ContextHelp.openHelpWindow, TYPO3.ContextHelp, {delegate: 'a.t3-help-link'});
},
/**
* Shows the tooltip, triggered from mouseover event handler
*
* @param {Event} event
* @param {Node} link
*/
showToolTipHelp: function(event, link) {
event.stopEvent();
var table = link.getAttribute('data-table');
var field = link.getAttribute('data-field');
var key = table + '.' + field;
var element = Ext.fly(link);
var response;
tip.target = element;
if (response = cshHelp.key(key)) {
tip.body.dom.innerHTML = response.description;
tip.cshLink = response.id;
tip.setTitle(response.title);
tip.showBy(element, 'tl-tr');
} else {
TYPO3.CSH.ExtDirect.getContextHelp(table, field, function(response, options) {
cshHelp[table + '.' + field] = response;
tip.body.dom.innerHTML = response.description;
tip.cshLink = response.id;
tip.setTitle(response.title);
cshHelp.add(response);
tip.showBy(element, 'tl-tr');
}, this);
}
},
/**
* Opens the help window, triggered from click event handler
*
* @param {Event} event
* @param {Node} link
*/
openHelpWindow: function(event, link) {
var id = link.getAttribute('data-table') + '.' + link.getAttribute('data-field');
event.stopEvent();
top.TYPO3.ContextHelpWindow.open(id);
}
}
}();
/**
* Calls the init on Ext.onReady
*/
Ext.onReady(TYPO3.ContextHelp.init, TYPO3.ContextHelp);
typo3/index.php (working copy)
}
// Starting page:
$this->content .= $TBE_TEMPLATE->startPage('TYPO3 Login: ' . htmlspecialchars($TYPO3_CONF_VARS['SYS']['sitename']));
$this->content .= $TBE_TEMPLATE->startPage('TYPO3 Login: ' . htmlspecialchars($TYPO3_CONF_VARS['SYS']['sitename']), FALSE);
// Add login form:
$this->content.=$this->wrapLoginForm($loginForm);
typo3/template.php (working copy)
* This includes the proper header with charset, title, meta tag and beginning body-tag.
*
* @param string HTML Page title for the header
* @param boolean flag for including CSH
* @return string Returns the whole header section of a HTML-document based on settings in internal variables (like styles, javascript code, charset, generator and docType)
* @see endPage()
*/
function startPage($title) {
function startPage($title, $includeCSH = TRUE) {
// hook pre start page
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preStartPageHook'])) {
$preStartPageHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preStartPageHook'];
......
}
// include the JS for the Context Sensitive Help
$this->loadCshJavascript();
if ($includeCSH) {
$this->loadCshJavascript();
}
// Get the browser info
$browserInfo = t3lib_utility_Client::getBrowserInfo(t3lib_div::getIndpEnv('HTTP_USER_AGENT'));
......
*/
protected function loadCshJavascript() {
$this->pageRenderer->loadExtJS();
$this->pageRenderer->addExtOnReadyCode('
Ext.getBody().on({
click: {
delegate: "a",
scope:this,
fn:function(event, link) {
var element = Ext.fly(link);
if (element.hasClass("typo3-csh-link") || element.hasClass("t3-help-link")) {
event.stopEvent();
top.TYPO3.ContextHelpWindow.open(link.rel);
}
}
}
});
');
$this->pageRenderer->addJsFile($this->backPath .'../t3lib/js/extjs/contexthelp.js');
$this->pageRenderer->addJsFile($this->backPath . 'ajax.php?ajaxID=ExtDirect::getAPI&namespace=TYPO3.CSH', NULL, FALSE);
$this->pageRenderer->addExtDirectCode();
}
/**
(1-1/2)