Index: t3lib/class.t3lib_recordlist.php
===================================================================
--- t3lib/class.t3lib_recordlist.php (Revision 9378)
+++ t3lib/class.t3lib_recordlist.php (Arbeitskopie)
@@ -374,8 +374,13 @@
* @return string Language icon
*/
function languageFlag($sys_language_uid) {
- return ($this->languageIconTitles[$sys_language_uid]['flagIcon'] ? ' ' : '').
- htmlspecialchars($this->languageIconTitles[$sys_language_uid]['title']);
+ $out = '';
+ if ($this->languageIconTitles[$sys_language_uid]['flagIcon']) {
+ $out .= t3lib_iconWorks::getSpriteIcon($this->languageIconTitles[$sys_language_uid]['flagIcon']);
+ $out .= ' ';
+ }
+ $out .= htmlspecialchars($this->languageIconTitles[$sys_language_uid]['title']);
+ return $out;
}
/**
Index: t3lib/class.t3lib_tceforms.php
===================================================================
--- t3lib/class.t3lib_tceforms.php (Revision 9378)
+++ t3lib/class.t3lib_tceforms.php (Arbeitskopie)
@@ -1813,8 +1813,13 @@
// Icon:
$selIconFile = '';
+ $selIconSprite = '';
if ($p[2]) {
list($selIconFile,$selIconInfo) = $this->getIcon($p[2]);
+ if ($selIconInfo === 'SPRITE') {
+ $selIconSprite = $selIconFile;
+ $selIconFile = '';
+ }
}
// Compile row:
@@ -1848,6 +1853,7 @@
insertDefStyle('check').' name="'.htmlspecialchars($PA['itemFormElName'].'['.$c.']').'" value="'.htmlspecialchars($p[1]).'"'.$sM.' onclick="'.htmlspecialchars($sOnChange).'"'.$PA['onFocus'].' /> |
'.
($selIconFile ? '' : '').
+ ($selIconSprite ? $selIconSprite . ' ' : '').
$label .
' |
' . (strcmp($p[3],'') ? $help : '') . ' |
@@ -4067,8 +4073,8 @@
/**
* Get icon (for example for selector boxes)
*
- * @param string Icon reference
- * @return array Array with two values; the icon file reference (relative to PATH_typo3 minus backPath), the icon file information array (getimagesize())
+ * @param string Icon reference (filename). Or "SPRITE:"
+ * @return array Array with two values; the icon file reference (relative to PATH_typo3 minus backPath), the icon file information array (getimagesize()). If $icon is a sprite, the full HTML will be returned in value 1, the second value will be "SPRITE"
*/
function getIcon($icon) {
if (substr($icon,0,4)=='EXT:') {
@@ -4084,6 +4090,9 @@
} elseif (substr($icon,0,4)=='ext/' || substr($icon,0,7)=='sysext/') {
$selIconFile = $this->backPath.$icon;
$selIconInfo = @getimagesize(PATH_typo3.$icon);
+ } elseif (preg_match('/^SPRITE:(.*)/', $icon, $matches)) {
+ $selIconFile = t3lib_iconWorks::getSpriteIcon($matches[1]);
+ $selIconInfo = 'SPRITE';
} else {
$selIconFile = t3lib_iconWorks::skinImg($this->backPath,'gfx/'.$icon,'',1);
$iconPath = substr($selIconFile, strlen($this->backPath));
@@ -6241,7 +6250,15 @@
}
}
- return ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon'] ? '' : ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['title'] ? '['.$this->cachedLanguageFlag[$mainKey][$sys_language_uid]['title'].']' : '')).' ';
+ $out = '';
+ if ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon']) {
+ $out .= t3lib_iconWorks::getSpriteIcon($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon']);
+ $out .= ' ';
+ } else if ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['title']) {
+ $out .= '['.$this->cachedLanguageFlag[$mainKey][$sys_language_uid]['title'].']';
+ $out .= ' ';
+ }
+ return $out;
}
/**
Index: t3lib/class.t3lib_transl8tools.php
===================================================================
--- t3lib/class.t3lib_transl8tools.php (Revision 9378)
+++ t3lib/class.t3lib_transl8tools.php (Arbeitskopie)
@@ -75,20 +75,19 @@
function getSystemLanguages($page_id=0,$backPath='') {
global $TCA,$LANG;
- // Icons and language titles:
- t3lib_div::loadTCA('sys_language');
- $flagAbsPath = t3lib_div::getFileAbsFileName($TCA['sys_language']['columns']['flag']['config']['fileFolder']);
- $flagIconPath = $backPath.'../'.substr($flagAbsPath, strlen(PATH_site));
-
$modSharedTSconfig = t3lib_BEfunc::getModTSconfig($page_id, 'mod.SHARED');
$languageIconTitles = array();
- // Set default:
+ // fallback "old iconstyles"
+ if (preg_match('/\.gif$/', $modSharedTSconfig['properties']['defaultLanguageFlag'])) {
+ $modSharedTSconfig['properties']['defaultLanguageFlag'] = str_replace('.gif', '', $modSharedTSconfig['properties']['defaultLanguageFlag']);
+ }
+
$languageIconTitles[0] = array(
'uid' => 0,
- 'title' => strlen ($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'].' ('.$LANG->getLL('defaultLanguage').')' : $LANG->getLL('defaultLanguage'),
+ 'title' => strlen($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'].' ('.$GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage').')' : $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage'),
'ISOcode' => 'DEF',
- 'flagIcon' => strlen($modSharedTSconfig['properties']['defaultLanguageFlag']) && @is_file($flagAbsPath.$modSharedTSconfig['properties']['defaultLanguageFlag']) ? $flagIconPath.$modSharedTSconfig['properties']['defaultLanguageFlag'] : null,
+ 'flagIcon' => strlen($modSharedTSconfig['properties']['defaultLanguageFlag']) ? 'flags-' . $modSharedTSconfig['properties']['defaultLanguageFlag'] : 'empty-empty',
);
// Set "All" language:
@@ -96,7 +95,7 @@
'uid' => -1,
'title' => $LANG->getLL('multipleLanguages'),
'ISOcode' => 'DEF',
- 'flagIcon' => $flagIconPath.'multi-language.gif',
+ 'flagIcon' => 'flags-multiple',
);
// Find all system languages:
@@ -115,7 +114,7 @@
}
}
if (strlen ($row['flag'])) {
- $languageIconTitles[$row['uid']]['flagIcon'] = @is_file($flagAbsPath.$row['flag']) ? $flagIconPath.$row['flag'] : '';
+ $languageIconTitles[$row['uid']]['flagIcon'] = t3lib_iconWorks::mapRecordTypeToSpriteIconName('sys_language', $row);
}
}
Index: t3lib/class.t3lib_befunc.php
===================================================================
--- t3lib/class.t3lib_befunc.php (Revision 9378)
+++ t3lib/class.t3lib_befunc.php (Arbeitskopie)
@@ -857,24 +857,25 @@
/**
* Returns an array with system languages:
*
- * @return array Array with languages
+ * Since TYPO3 4.5 the flagIcon is not returned as a filename in "gfx/flags/*" anymore,
+ * but as a string SPRITE:. The calling party should call
+ * t3lib_iconWorks::getSpriteIcon() to get an HTML which will represent
+ * the flag of this language.
+ *
+ * @return array Array with languages (title, uid, flagIcon)
*/
public static function getSystemLanguages() {
-
- // Initialize, add default language:
+ $languages = t3lib_div::makeInstance('t3lib_transl8tools')->getSystemLanguages();
$sysLanguages = array();
- $sysLanguages[] = array('Default language', 0);
-
- // Traverse languages
- $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,title,flag', 'sys_language', 'pid=0' . self::deleteClause('sys_language'));
- while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
- $sysLanguages[] = array(
- htmlspecialchars($row['title']) . ' [' . $row['uid'] . ']',
- $row['uid'],
- ($row['flag'] ? 'flags/' . $row['flag'] : '')
- );
+ foreach ($languages as $language) {
+ if($language['uid'] !== -1) {
+ $sysLanguages[] = array(
+ 0 => htmlspecialchars($language['title']) . ' [' . $language['uid'] . ']',
+ 1 => $language['uid'],
+ 2 => 'SPRITE:'.$language['flagIcon']
+ );
+ }
}
- $GLOBALS['TYPO3_DB']->sql_free_result($res);
return $sysLanguages;
}
Index: typo3/alt_doc.php
===================================================================
--- typo3/alt_doc.php (Revision 9378)
+++ typo3/alt_doc.php (Arbeitskopie)
@@ -1209,6 +1209,11 @@
global $LANG;
$modSharedTSconfig = t3lib_BEfunc::getModTSconfig($id, 'mod.SHARED');
+
+ // fallback non sprite-configuration
+ if (preg_match('/\.gif$/', $modSharedTSconfig['properties']['defaultLanguageFlag'])) {
+ $modSharedTSconfig['properties']['defaultLanguageFlag'] = str_replace('.gif', '', $modSharedTSconfig['properties']['defaultLanguageFlag']);
+ }
$languages = array(
0 => array(
Index: typo3/sysext/beuser/mod/index.php
===================================================================
--- typo3/sysext/beuser/mod/index.php (Revision 9378)
+++ typo3/sysext/beuser/mod/index.php (Arbeitskopie)
@@ -774,7 +774,9 @@
foreach ($items as $iCfg) {
if (isset($nef[$iCfg[1]])) {
unset($nef[$iCfg[1]]);
- if (strlen($iCfg[2])) {
+ if (preg_match('/^SPRITE:(.*)/', $iCfg[2], $match)) {
+ $icon = t3lib_iconWorks::getSpriteIcon($match[1]) . ' ';
+ } elseif (strlen($iCfg[2])) {
$icon = '';
} else {
$icon = '';