Project

General

Profile

Feature #17829 ยป template_viewpageicon.php.patch

Administrator Admin, 2007-11-21 18:21

View differences:

typo3/template.php (working copy)
*
* @param integer The page id
* @param string The current "BACK_PATH" (the back relative to the typo3/ directory)
* @param string Additional parameters for the image tag(s)
* @return string HTML string with linked icon(s)
*/
function viewPageIcon($id,$backPath,$addParams='hspace="3"') {
global $BE_USER;
$str = '';
function viewPageIcon($id,$backPath,$addParams='') {
global $BE_USER;
$str='';
$this->modSharedTSconfig = t3lib_BEfunc::getModTSconfig($id,'mod.SHARED');
if(isset($this->modSharedTSconfig['properties']['disablePageIconButtons'])) {
$this->disablePageIconButtons = t3lib_div::trimExplode(',',strtolower($this->modSharedTSconfig['properties']['disablePageIconButtons']),1);
if(is_array($this->disablePageIconButtons))
$this->disablePageIconButtons = array_flip($this->disablePageIconButtons);
}
// If access to Web>List for user, then link to that module.
if ($BE_USER->check('modules','web_list')) {
if ($BE_USER->check('modules','web_list') && !isset($this->disablePageIconButtons['web_list'])) {
$href=$backPath.'db_list.php?id='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
$str.= '<a href="'.htmlspecialchars($href).'">'.
'<img'.t3lib_iconWorks::skinImg($backPath,'gfx/list.gif','width="11" height="11"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList',1).'"'.($addParams?' '.trim($addParams):'').' alt="" />'.
$strItems['web_list'] = '<a href="'.htmlspecialchars($href).'">'.
'<img'.t3lib_iconWorks::skinImg($backPath,'gfx/list.gif','').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList',1).'"'.($addParams?' '.trim($addParams):'').' alt="" />'.
'</a>';
}
}
// Make link to view page
$str.= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($id,$backPath,t3lib_BEfunc::BEgetRootLine($id))).'">'.
'<img'.t3lib_iconWorks::skinImg($backPath,'gfx/zoom.gif','width="12" height="12"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage',1).'"'.($addParams?' '.trim($addParams):"").' hspace="3" alt="" />'.
if(!isset($this->disablePageIconButtons['view_page']))
$strItems['view_page'] = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($id,$backPath,t3lib_BEfunc::BEgetRootLine($id))).'">'.
'<img'.t3lib_iconWorks::skinImg($backPath,'gfx/zoom.gif','').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage',1).'"'.($addParams?' '.trim($addParams):"").' alt="" />'.
'</a>';
return $str;
// Create new record (general)
if(!isset($this->disablePageIconButtons['new_record']))
$strItems['new_record']= '<a href="'.htmlspecialchars($this->backPath.'db_new.php?id='.$id.'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_el.gif','').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.php:newRecordGeneral',1).'" alt="" />'.
'</a>';
// Create new page (pages)
if(isset($this->disablePageIconButtons['new_page']))
$strItems['new_page']= '<a href="'.htmlspecialchars($this->backPath.'db_new.php?id='.$id.'&pagesOnly=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_page.gif','').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.php:newRecordGeneral',1).' (pages)" alt="" />'.
'</a>';
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['addViewPageIcons']) && is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['addViewPageIcons'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['addViewPageIcons'] as $classRef) {
$hookObj= &t3lib_div::getUserObj($classRef);
if (method_exists($hookObj, 'addViewPageIcons'))
$hookObj->addViewPageIcons($strItems,$id,$backPath,$this,$this->disablePageIconButtons);
}
}
$defaultOrderList='web_list,view_page,new_record';
if($this->modSharedTSconfig['properties']['viewPageIconsOrder'])
$orderList=$this->modSharedTSconfig['properties']['viewPageIconsOrder'];
else $orderList=$defaultOrderList;
$orderList = t3lib_div::trimExplode(',',strtolower($orderList),1);
if(isset($strItems) && is_array($strItems) && is_array($orderList)) {
$str = '<span class="viewPageIcons">';
$orderList=array_flip($orderList);
foreach($orderList as $strItem => $item) {
if(array_key_exists($strItem,$strItems))
$str .= $strItems[$strItem];
}
$str .= '</span>';
}
return $str;
}
/**
* Returns a URL with a command to TYPO3 Core Engine (tce_db.php)
* See description of the API elsewhere.
*
    (1-1/1)