From: scyrma Date: Thu, 11 Sep 2008 07:48:35 +0000 (+0000) Subject: MDL-15351: testing to make folder expanded by default X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=30868c40ae643d0aafd739632953cbc61b6ce581;p=moodle.git MDL-15351: testing to make folder expanded by default --- diff --git a/repository/local/repository.class.php b/repository/local/repository.class.php index f5367d2ee9..ad282dcbe0 100755 --- a/repository/local/repository.class.php +++ b/repository/local/repository.class.php @@ -107,7 +107,8 @@ class repository_local extends repository { */ private function build_tree($fileinfo, $search, $dynamicmode, &$list) { global $CFG; - + + $filecount = 0; $children = $fileinfo->get_children(); foreach ($children as $child) { @@ -143,11 +144,15 @@ class repository_local extends repository { if ($search && stristr($tmp['title'], $search) !== false) { $_search = false; } - $filecount = $this->build_tree($child, $_search, $dynamicmode, $tmp['children']); + if ( $_filecount = $this->build_tree($child, $_search, $dynamicmode, $tmp['children']) ) { + $tmp['expanded'] = 1; + } + //} - if (!$search || $filecount || (stristr($tmp['title'], $search) !== false)) { + if (!$search || $_filecount || (stristr($tmp['title'], $search) !== false)) { $list[] = $tmp; + $filecount += $_filecount; } } else { // not a directory @@ -162,10 +167,11 @@ class repository_local extends repository { 'source' => $child->get_url(), 'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo_from_type("icon", $filetype) ); + $filecount++; } } - return $list; + return $filecount; } public function print_listing() {