From 3df72098bbc205fa4bd4735d52d2626baad93548 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 19 May 2006 18:50:23 +0200 Subject: new mediamanager This patch adds a completely rewritten media popup. The following noteworthy changes were made: - media manager uses a collapsible namespace tree - media manager uses AJAX if available - media manager popup can be kept open when selecting a media file - only one template is used for the media manager :!: Template - Editable image metadata is configured in conf/mediameta.php now - The JS cookie mechanism was enhanced to store key/value pairs - Language strings can be exported to JS in js.php darcs-hash:20060519165023-7ad00-4932b4553fc919aa4a8b8187958b823acf4f8cee.gz --- lib/exe/ajax.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'lib/exe/ajax.php') diff --git a/lib/exe/ajax.php b/lib/exe/ajax.php index 886e9829d..c9b93a4b8 100644 --- a/lib/exe/ajax.php +++ b/lib/exe/ajax.php @@ -97,6 +97,8 @@ function ajax_lock(){ /** * Delete a draft + * + * @author Andreas Gohr */ function ajax_draftdel(){ $id = cleanID($_POST['id']); @@ -109,5 +111,39 @@ function ajax_draftdel(){ @unlink($cname); } +/** + * Return subnamespaces for the Mediamanager + */ +function ajax_medians(){ + global $conf; + require_once(DOKU_INC.'inc/search.php'); + require_once(DOKU_INC.'inc/media.php'); + + // wanted namespace + $ns = cleanID($_POST['ns']); + $dir = utf8_encodeFN(str_replace(':','/',$ns)); + + $lvl = count(explode(':',$ns)); + + $data = array(); + search($data,$conf['mediadir'],'search_index',array(),$dir); + foreach($data as $item){ + $item['level'] = $lvl+1; + echo media_nstree_li($item); + echo media_nstree_item($item); + echo ''; + } +} + +/** + * Return subnamespaces for the Mediamanager + */ +function ajax_medialist(){ + global $conf; + require_once(DOKU_INC.'inc/media.php'); + + media_filelist($_POST['ns']); +} + //Setup VIM: ex: et ts=2 enc=utf-8 : ?> -- cgit v1.2.3