From 396c218f61d8626a516941cd6cd66f09e528e32c Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 27 Aug 2010 10:37:07 +0200 Subject: make use of tpl_get_action in tpl_actiondropdown FS#2005 --- inc/actions.php | 2 ++ inc/template.php | 71 ++++++++++++++++++++------------------------------------ 2 files changed, 27 insertions(+), 46 deletions(-) (limited to 'inc') diff --git a/inc/actions.php b/inc/actions.php index 914ff1ce6..3e0cb1207 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -185,6 +185,8 @@ function act_clean($act){ if($act == 'export_html') $act = 'export_xhtml'; if($act == 'export_htmlbody') $act = 'export_xhtmlbody'; + if($act === '') $act = 'show'; + // check if action is disabled if(!actionOK($act)){ msg('Command disabled: '.htmlspecialchars($act),-1); diff --git a/inc/template.php b/inc/template.php index f1995b6ba..003febe46 100644 --- a/inc/template.php +++ b/inc/template.php @@ -491,7 +491,7 @@ function tpl_actionlink($type,$pre='',$suf='',$inner='',$return=false){ return true; } - /** +/** * Check the actions and get data for buttons and links * * Available actions are @@ -1147,7 +1147,7 @@ function tpl_actiondropdown($empty='',$button='>'){ global $auth; echo '
'; #FIXME action - echo ''; + echo ''; if($REV) echo ''; echo ''; @@ -1155,60 +1155,39 @@ function tpl_actiondropdown($empty='',$button='>'){ echo ''; echo ''; - // 'edit' - most complicated type, we need to decide on current action - if($ACT == 'show' || $ACT == 'search'){ - if($INFO['writable']){ - if(!empty($INFO['draft'])) { - echo ''; - } else { - if($INFO['exists']){ - echo ''; - }else{ - echo ''; - } - } - }else if(actionOK('source')) { //pseudo action - echo ''; - } - }else{ - echo ''; - } + $act = tpl_get_action('edit'); + if($act) echo ''; - echo ''; - if($INFO['ismanager'] && $REV && $INFO['writable'] && actionOK('revert')){ - echo ''; - } - echo ''; + $act = tpl_get_action('revisions'); + if($act) echo ''; + + $act = tpl_get_action('revert'); + if($act) echo ''; + + $act = tpl_get_action('backlink'); + if($act) echo ''; echo ''; echo ''; - echo ''; - echo ''; + $act = tpl_get_action('recent'); + if($act) echo ''; + + $act = tpl_get_action('index'); + if($act) echo ''; echo ''; echo ''; - if($conf['useacl'] && $auth){ - if($_SERVER['REMOTE_USER']){ - echo ''; - }else{ - echo ''; - } - } + $act = tpl_get_action('login'); + if($act) echo ''; - if($conf['useacl'] && $auth && $_SERVER['REMOTE_USER'] && - $auth->canDo('Profile') && ($ACT!='profile')){ - echo ''; - } + $act = tpl_get_action('profile'); + if($act) echo ''; - if($conf['useacl'] && $auth && $ACT == 'show' && $conf['subscribers']){ - if($_SERVER['REMOTE_USER']){ - echo ''; - } - } + $act = tpl_get_action('subscribe'); + if($act) echo ''; - if($INFO['ismanager']){ - echo ''; - } + $act = tpl_get_action('admin'); + if($act) echo ''; echo ''; echo ''; -- cgit v1.2.3