/** * Return subnamespaces for the Mediamanager * * @author Andreas Gohr <*****@*****.**> */ function ajax_medians() { global $conf; // 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('nofiles' => true), $dir); foreach ($data as $item) { $item['level'] = $lvl + 1; echo media_nstree_li($item); echo media_nstree_item($item); echo '</li>'; } }
/** * Build a tree outline of available media namespaces * * @author Andreas Gohr <*****@*****.**> */ function media_nstree($ns) { global $conf; global $lang; // currently selected namespace $ns = cleanID($ns); if (empty($ns)) { $ns = dirname(str_replace(':', '/', $ID)); if ($ns == '.') { $ns = ''; } } $ns = utf8_encodeFN(str_replace(':', '/', $ns)); $data = array(); search($data, $conf['mediadir'], 'search_index', array('ns' => $ns, 'nofiles' => true)); // wrap a list with the root level around the other namespaces $item = array('level' => 0, 'id' => '', 'open' => 'true', 'label' => '[' . $lang['mediaroot'] . ']'); echo '<ul class="idx">'; echo media_nstree_li($item); echo media_nstree_item($item); echo html_buildlist($data, 'idx', 'media_nstree_item', 'media_nstree_li'); echo '</li>'; echo '</ul>'; }