diff options
author | Andreas Gohr <andi@splitbrain.org> | 2009-08-30 13:14:38 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2009-08-30 13:14:38 +0200 |
commit | c182313eb4e1146476bd73b7fbb9fdf66266a69f (patch) | |
tree | 524adf004c80100faf23afe5bb6fb96ad8869179 /inc/template.php | |
parent | 254a31a4fcebbf08d9f2c036bd92bb4cd9deb2d8 (diff) | |
download | rpg-c182313eb4e1146476bd73b7fbb9fdf66266a69f.tar.gz rpg-c182313eb4e1146476bd73b7fbb9fdf66266a69f.tar.bz2 |
added MEDIAMANAGER_CONTENT_OUTPUT event
Ignore-this: 1742cf72bee0a1ac1898109ba5afc962
darcs-hash:20090830111438-7ad00-120e8fa9ce41e4317676dc2e9d5cf113a418ec44.gz
Diffstat (limited to 'inc/template.php')
-rw-r--r-- | inc/template.php | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/inc/template.php b/inc/template.php index f84f2ed11..17b57c23f 100644 --- a/inc/template.php +++ b/inc/template.php @@ -1166,24 +1166,54 @@ function tpl_loadConfig(){ * * Only allowed in mediamanager.php * + * @triggers MEDIAMANAGER_CONTENT_OUTPUT + * @param bool $fromajax - set true when calling this function via ajax * @author Andreas Gohr <andi@splitbrain.org> */ -function tpl_mediaContent(){ +function tpl_mediaContent($fromajax=false){ global $IMG; global $AUTH; global $INUSE; global $NS; global $JUMPTO; - ptln('<div id="media__content">'); - if($_REQUEST['edit']){ - media_metaform($IMG,$AUTH); - }elseif(is_array($INUSE)){ - media_filesinuse($INUSE,$IMG); + if(is_array($_REQUEST['do'])){ + $do = array_shift(array_keys($_REQUEST['do'])); }else{ - media_filelist($NS,$AUTH,$JUMPTO); + $do = $_REQUEST['do']; } - ptln('</div>'); + if(in_array($do,array('save','cancel'))) $do = ''; + + if(!$do){ + if($_REQUEST['edit']){ + $do = 'metaform'; + }elseif(is_array($INUSE)){ + $do = 'filesinuse'; + }else{ + $do = 'filelist'; + } + } + + // output the content pane, wrapped in an event. + if(!$fromajax) ptln('<div id="media__content">'); + $data = array( 'do' => $do); + $evt = new Doku_Event('MEDIAMANAGER_CONTENT_OUTPUT', $data); + if ($evt->advise_before()) { + $do = $data['do']; + if($do == 'metaform'){ + media_metaform($IMG,$AUTH); + }elseif($do == 'filesinuse'){ + media_filesinuse($INUSE,$IMG); + }elseif($do == 'filelist'){ + media_filelist($NS,$AUTH,$JUMPTO); + }else{ + msg('Unknown action '.hsc($do),-1); + } + } + $evt->advise_after(); + unset($evt); + if(!$fromajax) ptln('</div>'); + } /** |