Thanks - fixed this.infograf768 wrote: 1. the View Files icon not working. Clicking on the figure in the column works.
Have added the XML phrase definition to the INI files.infograf768 wrote: 2. When language debugging is on in Global Config, xml column icons and Files number show the ?? ?? as if these strings had to be translated.
The files number, and other strings, got the ?? ?? in debug mode because they were passed through the TranslationsView::tooltip() function. I've changed this so that it is more configurable, as below.
Will wait for any more corrections/bugs before posting revised code to forge. Hopefully getting this pretty near final by now. Thanks for all your help.
igevans
Code: Select all
/**
* Lookup and return a tooltip, using JText
*
* The default behaviour when using JText is
* 1: if $caption is not set, set it to match $html
* 2: if $tip is not set, lookup a JText key in the format '$caption DESC' and use it ONLY IF DEFINED
*
* @param string The HTML over which the tooltip will appear
* @param string The tooltip
* @param string The tooltip caption
* @param string A string including characters H T C to trigger JText of Html Tip Caption
* @param boolean Use Overlib instead of mootools
* @return string The HTML output
*/
function tooltip ( $html, $tip=null, $caption=null, $jtext = 'HTC', $overlib = false )
{
// prepare JText config
$jtext = ' ' . strtoupper($jtext);
// 1: lookup an Automatic JText tip and caption
// 2: lookup an Automatic JText caption
// 3: lookup JText $tip and $caption
if ($jtext) {
if (is_null($tip)) {
$caption_key = ($caption) ? $caption : $html;
$tip_key = $caption_key . ' DESC';
$caption = strpos($jtext,'C') ? JText::_($caption_key) : $caption_key;
$tip = strpos($jtext,'T') ? JText::_($tip_key) : $tip_key;
$tip = ($tip==$tip_key) ? '' : $tip;
} else if (is_null($caption)) {
$caption = strpos($jtext,'C') ? JText::_($html) : $html;
} else {
$caption = strpos($jtext,'C') ? JText::_($caption) : $caption;
$tip = strpos($jtext,'T') ? JText::_($tip) : $tip;
}
// lookup JText $html
$html = strpos($jtext,'H') ? JText::_($html) : $html;
}
// add the tooltip to the html
if (($tip) || ($caption!=$html)) {
// apply title to tip
if (!$tip) {
$tip = $caption;
$caption = '';
}
// 1: overlib method (manually include overlib JS)
// 2: class/mootools method
if ($overlib) {
global $mainframe;
$url = $mainframe->isAdmin() ? $mainframe->getSiteURL() : JURI::base();
if ( !$mainframe->get( 'loadOverlib' ) ) {
$doc =& JFactory::getDocument();
$doc->addScript($url.'includes/js/overlib_mini.js');
$doc->addScript($url.'includes/js/overlib_hideform_mini.js');
$mainframe->set( 'loadOverlib', true );
}
// build HTML
$html = '<span onmouseover="return overlib(\'' . addslashes($tip) . '\',' . ( $caption ? 'CAPTION,\'' . addslashes($caption) . '\',' : '' ) . 'HAUTO,VAUTO);" onmouseout="return nd();">' . $html . '</span>';
} else {
JCommonHTML::loadOverlib();
$html = '<span class="hasTip" title="' . ( $caption ? htmlspecialchars($caption) . '::' : '' ) . htmlspecialchars($tip) . '">' . $html . '</span>';
}
}
// return
return $html;
}