Project

General

Profile

Feature #15030 » 2005-10-20_bugfix_1574.patch

Administrator Admin, 2005-10-20 12:28

View differences:

t3lib/class.t3lib_befunc.php 20 Oct 2005 10:27:14 -0000
}
/**
* Returns title-attribute information for a page-record informing about id, alias, doktype, hidden, starttime, endtime, fe_group etc.
* Usage: 8
* Returns title-attribute information for any record informing about id, alias, doktype, hidden, starttime, endtime, fe_group etc.
*
* @param string name of the table
* @param array Input must be a page row ($row) with the proper fields set (be sure - send the full range of fields for the table)
* @param string $perms_clause is used to get the record path of the shortcut page, if any (and doktype==4)
* @param boolean If $includeAttrib is set, then the 'title=""' attribute is wrapped about the return value, which is in any case htmlspecialchar()'ed already
* @return string
*/
function titleAttribForPages($row,$perms_clause='',$includeAttrib=1) {
function titleAttribForRecords($table,$row,$perms_clause='',$includeAttrib=1) {
global $TCA,$LANG;
$parts=array();
$parts[] = 'id='.$row['uid'];
if ($row['alias']) $parts[]=$LANG->sL($TCA['pages']['columns']['alias']['label']).' '.$row['alias'];
if ($row['pid']<0) $parts[] = 'v#1.'.$row['t3ver_id'];
if ($row['alias']) $parts[]=$LANG->sL($TCA[$table]['columns']['alias']['label']).' '.$row['alias'];
if ($row['pid']<0 && $TCA[$table]['ctrl']['versioningWS'])
$parts[] = 'v#1.'.$row['t3ver_id'];
if ($row['doktype']=='3') {
$parts[]=$LANG->sL($TCA['pages']['columns']['url']['label']).' '.$row['url'];
} elseif ($row['doktype']=='4') {
if ($perms_clause) {
$label = t3lib_BEfunc::getRecordPath(intval($row['shortcut']),$perms_clause,20);
} else {
$lRec = t3lib_BEfunc::getRecord('pages',intval($row['shortcut']),'title');
$lRec = t3lib_BEfunc::getRecord($table,intval($row['shortcut']),'title');
$label = $lRec['title'];
}
if ($row['shortcut_mode']>0) {
$label.=', '.$LANG->sL($TCA['pages']['columns']['shortcut_mode']['label']).' '.
$LANG->sL(t3lib_BEfunc::getLabelFromItemlist('pages','shortcut_mode',$row['shortcut_mode']));
$label.=', '.$LANG->sL($TCA[$table]['columns']['shortcut_mode']['label']).' '.
$LANG->sL(t3lib_BEfunc::getLabelFromItemlist($table,'shortcut_mode',$row['shortcut_mode']));
}
$parts[]=$LANG->sL($TCA['pages']['columns']['shortcut']['label']).' '.$label;
$parts[]=$LANG->sL($TCA[$table]['columns']['shortcut']['label']).' '.$label;
} elseif ($row['doktype']=='7') {
if ($perms_clause) {
$label = t3lib_BEfunc::getRecordPath(intval($row['mount_pid']),$perms_clause,20);
} else {
$lRec = t3lib_BEfunc::getRecord('pages',intval($row['mount_pid']),'title');
$lRec = t3lib_BEfunc::getRecord($table,intval($row['mount_pid']),'title');
$label = $lRec['title'];
}
$parts[]=$LANG->sL($TCA['pages']['columns']['mount_pid']['label']).' '.$label;
$parts[]=$LANG->sL($TCA[$table]['columns']['mount_pid']['label']).' '.$label;
if ($row['mount_pid_ol']) {
$parts[] = $LANG->sL($TCA['pages']['columns']['mount_pid_ol']['label']);
$parts[] = $LANG->sL($TCA[$table]['columns']['mount_pid_ol']['label']);
}
}
if ($row['nav_hide']) $parts[] = ereg_replace(':$','',$LANG->sL($TCA['pages']['columns']['nav_hide']['label']));
if ($row['hidden']) $parts[] = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.hidden');
if ($row['starttime']) $parts[] = $LANG->sL($TCA['pages']['columns']['starttime']['label']).' '.t3lib_BEfunc::dateTimeAge($row['starttime'],-1,'date');
if ($row['endtime']) $parts[] = $LANG->sL($TCA['pages']['columns']['endtime']['label']).' '.t3lib_BEfunc::dateTimeAge($row['endtime'],-1,'date');
if ($row['fe_group']) {
if ($row['fe_group']<0) {
$label = $LANG->sL(t3lib_BEfunc::getLabelFromItemlist('pages','fe_group',$row['fe_group']));
if ($row['nav_hide'])
$parts[] = ereg_replace(':$','',$LANG->sL($TCA[$table]['columns']['nav_hide']['label']));
$enableColumns = $TCA[$table]['ctrl']['enablecolumns'];
if ($row[$enableColumns['disabled']] && $enableColumns['disabled'])
$parts[] = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.hidden');
if ($row[$enableColumns['starttime']] && $enableColumns['starttime'])
$parts[] = $LANG->sL($TCA[$table]['columns'][$enableColumns['starttime']]['label']).' '.t3lib_BEfunc::dateTimeAge($row[$enableColumns['starttime']],-1,'date');
if ($row[$enableColumns['endtime']] && $enableColumns['endtime'])
$parts[] = $LANG->sL($TCA[$table]['columns'][$enableColumns['endtime']]['label']).' '.t3lib_BEfunc::dateTimeAge($row[$enableColumns['endtime']],-1,'date');
if ($row[$enableColumns['fe_group']]) {
if ($row[$enableColumns['fe_group']]<0) {
$label = $LANG->sL(t3lib_BEfunc::getLabelFromItemlist($table,'fe_group',$row[$enableColumns['fe_group']]));
} else {
$lRec = t3lib_BEfunc::getRecord('fe_groups',$row['fe_group'],'title');
$lRec = t3lib_BEfunc::getRecord('fe_groups',$row[$enableColumns['fe_group']],'title');
$label = $lRec['title'];
}
$parts[] = $LANG->sL($TCA['pages']['columns']['fe_group']['label']).' '.$label;
$parts[] = $LANG->sL($TCA['pages']['columns'][$enableColumns['fe_group']]['label']).' '.$label;
}
$out = htmlspecialchars(implode(' - ',$parts));
return $includeAttrib ? 'title="'.$out.'"' : $out;
}
/**
* Returns title-attribute information for page-table informing about id, alias, doktype, hidden, starttime, endtime, fe_group etc.
* This function is only a wrapper because of compatibility reasons for t3lib_BEfunc::titleAttribForRecords, which has the same arguments, except its first argument is the database table. It is recommended to use that function instead.
* Usage: 8
*
* @param array Input must be a page row ($row) with the proper fields set (be sure - send the full range of fields for the table)
* @param string $perms_clause is used to get the record path of the shortcut page, if any (and doktype==4)
* @param boolean If $includeAttrib is set, then the 'title=""' attribute is wrapped about the return value, which is in any case htmlspecialchar()'ed already
* @return string
* @deprecated
*/
function titleAttribForPages($row,$perms_clause='',$includeAttrib=1) {
return t3lib_BEfunc::titleAttribForRecords('pages', $row, $perms_clause, $includeAttrib);
}
/**
* Returns title-attribute information for ANY record (from a table defined in TCA of course)
......
* @return string
*/
function getRecordIconAltText($row,$table='pages') {
if ($table=='pages') {
$out = t3lib_BEfunc::titleAttribForPages($row,'',0);
} else {
$ctrl = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns'];
$out='id='.$row['uid']; // Uid is added
if ($table=='pages' && $row['alias']) {
$out.=' / '.$row['alias'];
}
if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS'] && $row['pid']<0) {
$out.=' - v#1.'.$row['t3ver_id'];
}
if ($ctrl['disabled']) { // Hidden ...
$out.=($row[$ctrl['disabled']]?' - '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.hidden'):'');
}
if ($ctrl['starttime']) {
if ($row[$ctrl['starttime']] > $GLOBALS['EXEC_TIME']) {
$out.=' - '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.starttime').':'.t3lib_BEfunc::date($row[$ctrl['starttime']]).' ('.t3lib_BEfunc::daysUntil($row[$ctrl['starttime']]).' '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.days').')';
}
}
if ($row[$ctrl['endtime']]) {
$out.=' - '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.endtime').': '.t3lib_BEfunc::date($row[$ctrl['endtime']]).' ('.t3lib_BEfunc::daysUntil($row[$ctrl['endtime']]).' '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.days').')';
}
}
return htmlspecialchars($out);
return htmlspecialchars(t3lib_BEfunc::titleAttribForRecords($table,$row,'',0));
}
/**
t3lib/class.t3lib_browsetree.php 20 Oct 2005 10:27:14 -0000
}
return $theIcon;
}
/**
* Get icon for the row.
* If $this->iconPath and $this->iconName is set, try to get icon based on those values.
*
* @param array Item row.
* @return string Image tag.
*/
function getIcon($row) {
if ($this->iconPath && $this->iconName) {
$icon = '<img'.t3lib_iconWorks::skinImg('',$this->iconPath.$this->iconName,'width="18" height="16"').' />';
} else {
$icon = t3lib_iconWorks::getIconImage($this->table,$row,$this->backPath,'align="top" class="c-recIcon" ');
}
return $this->wrapIcon($icon,$row);
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_browsetree.php']) {
(2-2/2)