From 820fa24b2cc7cd677f9e392f5834e69bc3e46dc5 Mon Sep 17 00:00:00 2001 From: andi Date: Fri, 11 Mar 2005 15:56:11 +0100 Subject: more template additions - media selection works again darcs-hash:20050311145611-9977f-6a2987fbe10ba90cf279a3874d8d7510e63294b5.gz --- inc/html.php | 3 +- inc/template.php | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/html.php b/inc/html.php index 85e3189ea..df3f446b5 100644 --- a/inc/html.php +++ b/inc/html.php @@ -293,6 +293,7 @@ function html_btn($name,$id,$akey,$params,$method='get'){ /** * Check for the given permission or prints an error * + * @deprecated * @author Andreas Gohr */ function html_acl($perm){ @@ -596,7 +597,7 @@ function html_search(){ print ''; } }else{ - print '
'.$lang['nothingfound'].'
'; + print '
'.$lang['nothingfound'].'
'; } //hide progressbar diff --git a/inc/template.php b/inc/template.php index 233ded96b..d52d5c7a0 100644 --- a/inc/template.php +++ b/inc/template.php @@ -96,6 +96,9 @@ function tpl_content(){ case 'register': html_register(); break; + case 'denied': + print parsedLocale('denied'); + break; default: msg("Failed to handle command: ".hsc($ACT),-1); } @@ -307,4 +310,84 @@ function tpl_pageinfo(){ } } +/** + * Print a list of namespaces containing media files + * + * @author Andreas Gohr + */ +function tpl_medianamespaces(){ + global $conf; + + $data = array(); + search($data,$conf['mediadir'],'search_namespaces',array()); + print html_buildlist($data,'idx',media_html_list_namespaces); +} + +/** + * Print a list of mediafiles in the current namespace + * + * @author Andreas Gohr + */ +function tpl_mediafilelist(){ + global $conf; + global $lang; + global $NS; + $dir = utf8_encodeFN(str_replace(':','/',$NS)); + + $data = array(); + search($data,$conf['mediadir'],'search_media',array(),$dir); + + if(!count($data)){ + ptln('
'.$lang['nothingfound'].'
'); + return; + } + + ptln('
    ',2); + foreach($data as $item){ + ptln('
  • ',4); + ptln(''. + utf8_decodeFN($item['file']). + '',6); + if($item['isimg']){ + ptln('('.$item['info'][0].'×'.$item['info'][1]. + ' '.filesize_h($item['size']).')
    ',6); + + # build thumbnail + $link=array(); + $link['name']=$item['id']; + if($item['info'][0]>120) $link['name'] .= '?120'; + $link = format_link_media($link); + ptln($link['name'],6); + + }else{ + ptln ('('.filesize_h($item['size']).')',6); + } + ptln('
  • ',4); + } + ptln('
',2); +} + +/** + * Print the media upload form if permissions are correct + * + * @author Andreas Gohr + */ +function tpl_mediauploadform(){ + global $NS; + global $UPLOADOK; + global $lang; + + if(!$UPLOADOK) return; + + ptln('
',2); + ptln($lang['txt_upload'].':
',4); + ptln('',4); + ptln('
',4); + ptln($lang['txt_filename'].'
',4); + ptln('',4); + ptln('',4); + ptln('
',2); +} + ?> -- cgit v1.2.3