diff options
author | Andreas Gohr <andi@splitbrain.org> | 2007-07-16 20:46:05 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2007-07-16 20:46:05 +0200 |
commit | a06884abe180891c09730983f2b8d13662c3fd34 (patch) | |
tree | ee5c49faf32390245e1cf3c720a642e148c775a3 /lib/exe/ajax.php | |
parent | 40cc87038bae8c160922eca41f9f9dde28b04cb5 (diff) | |
download | rpg-a06884abe180891c09730983f2b8d13662c3fd34.tar.gz rpg-a06884abe180891c09730983f2b8d13662c3fd34.tar.bz2 |
AJAX for the index view
This makes the index view much more responsive by loading sub namespaces through AJAX
if JavaScript is available.
The used throbber image probably looks bad on dark backgrounds. If someone could provide
a better one it would be greatly appreciated.
darcs-hash:20070716184605-7ad00-adf298ee3303d50f2b4b6b66e5ea3ff8d8c2bf9a.gz
Diffstat (limited to 'lib/exe/ajax.php')
-rw-r--r-- | lib/exe/ajax.php | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/lib/exe/ajax.php b/lib/exe/ajax.php index 3f64dc7ac..8bcf184b5 100644 --- a/lib/exe/ajax.php +++ b/lib/exe/ajax.php @@ -28,7 +28,7 @@ if(isset($_POST['call'])) else if(isset($_GET['call'])) $call = 'ajax_'.$_GET['call']; else - return; + exit; if(function_exists($call)){ $call(); }else{ @@ -167,6 +167,8 @@ function ajax_draftdel(){ /** * Return subnamespaces for the Mediamanager + * + * @author Andreas Gohr <andi@splitbrain.org> */ function ajax_medians(){ global $conf; @@ -190,7 +192,9 @@ function ajax_medians(){ } /** - * Return subnamespaces for the Mediamanager + * Return list of files for the Mediamanager + * + * @author Andreas Gohr <andi@splitbrain.org> */ function ajax_medialist(){ global $conf; @@ -199,5 +203,33 @@ function ajax_medialist(){ media_filelist($_POST['ns']); } +/** + * Return sub index for index view + * + * @author Andreas Gohr <andi@splitbrain.org> + */ +function ajax_index(){ + global $conf; + require_once(DOKU_INC.'inc/search.php'); + require_once(DOKU_INC.'inc/html.php'); + + // wanted namespace + $ns = cleanID($_POST['idx']); + $dir = utf8_encodeFN(str_replace(':','/',$ns)); + + $lvl = count(explode(':',$ns)); + + $data = array(); + search($data,$conf['datadir'],'search_index',array('ns' => $ns),$dir); + foreach($data as $item){ + $item['level'] = $lvl+1; + echo html_li_index($item); + echo '<div class="li">'; + echo html_list_index($item); + echo '</div>'; + echo '</li>'; + } +} + //Setup VIM: ex: et ts=2 enc=utf-8 : ?> |