Beispiel #1
0
 /**
  * Print index nodes
  *
  * @author Samuele Tognini <*****@*****.**>
  * @author Andreas Gohr <*****@*****.**>
  */
 function print_index($ns)
 {
     require_once DOKU_PLUGIN . 'indexmenu/syntax/indexmenu.php';
     global $conf;
     $idxm = new syntax_plugin_indexmenu_indexmenu();
     $ns = $idxm->_parse_ns($ns);
     $level = -1;
     $max = 0;
     $data = array();
     if ($_REQUEST['max'] > 0) {
         $max = $_REQUEST['max'];
         $level = $max;
     }
     $nss = $_REQUEST['nss'] ? cleanID($_REQUEST['nss']) : '';
     $idxm->sort = $_REQUEST['sort'];
     $idxm->msort = $_REQUEST['msort'];
     $idxm->rsort = $_REQUEST['rsort'];
     $idxm->nsort = $_REQUEST['nsort'];
     $fsdir = "/" . utf8_encodeFN(str_replace(':', '/', $ns));
     $opts = array('level' => $level, 'nons' => $_REQUEST['nons'], 'nss' => array(array($nss, 1)), 'max' => $max, 'js' => false, 'nopg' => $_REQUEST['nopg'], 'skip_index' => $idxm->getConf('skip_index'), 'skip_file' => $idxm->getConf('skip_file'), 'headpage' => $idxm->getConf('headpage'), 'hide_headpage' => $idxm->getConf('hide_headpage'));
     if ($idxm->sort || $idxm->msort || $idxm->rsort) {
         $idxm->_search($data, $conf['datadir'], array($idxm, '_search_index'), $opts, $fsdir);
     } else {
         search($data, $conf['datadir'], array($idxm, '_search_index'), $opts, $fsdir);
     }
     if ($_REQUEST['nojs']) {
         require_once DOKU_INC . 'inc/html.php';
         $out_tmp = html_buildlist($data, 'idx', array($idxm, "_html_list_index"), "html_li_index");
         $out .= preg_replace('/<ul class="idx">(.*)<\\/ul>/s', "\$1", $out_tmp);
     } else {
         $nodes = $idxm->_jsnodes($data, '', 0);
         $out = "ajxnodes = [";
         $out .= rtrim($nodes[0], ",");
         $out .= "];";
     }
     return $out;
 }