"- using an ordered list to get a count of dir entries

- caching the current path in session, for easier debugging"
This commit is contained in:
Ralf Becker 2009-05-03 18:48:36 +00:00
parent 5a22640c82
commit aef4125146

View File

@ -15,8 +15,10 @@ $GLOBALS['egw_info']['flags'] = array(
); );
include('../header.inc.php'); include('../header.inc.php');
$path = '/home/'.$GLOBALS['egw_info']['user']['account_lid']; if (!($path = egw_cache::getSession('filemanger','test')))
{
$path = '/home/'.$GLOBALS['egw_info']['user']['account_lid'];
}
if (isset($_REQUEST['path'])) $path = $_REQUEST['path']; if (isset($_REQUEST['path'])) $path = $_REQUEST['path'];
echo html::form("<p>Path: ".html::input('path',$path,'text','size="40"'). echo html::form("<p>Path: ".html::input('path',$path,'text','size="40"').
html::submit_button('',lang('Submit'))."</p>\n",array(),'','','','','GET'); html::submit_button('',lang('Submit'))."</p>\n",array(),'','','','','GET');
@ -27,6 +29,8 @@ if (isset($path) && !empty($path))
{ {
throw new egw_exception_wrong_userinput('Not an absolute path!'); throw new egw_exception_wrong_userinput('Not an absolute path!');
} }
egw_cache::setSession('filemanger','test',$path);
echo "<h2>"; echo "<h2>";
foreach(explode('/',$path) as $n => $part) foreach(explode('/',$path) as $n => $part)
{ {
@ -54,7 +58,7 @@ if (isset($path) && !empty($path))
$files[] = $file; $files[] = $file;
} }
closedir($d); closedir($d);
echo ($files ? '<ul><li>'.implode("</li>\n<li>",$files).'</ul>' : '<p>Empty directory</p>')."\n"; echo ($files ? '<ol><li>'.implode("</li>\n<li>",$files).'</ol>' : '<p>Empty directory</p>')."\n";
} }
echo "<p><b>stat('$path')</b> took $time ms (mode = ".(isset($stat['mode'])?sprintf('%o',$stat['mode']).' = '.egw_vfs::int2mode($stat['mode']):'NULL').')'; echo "<p><b>stat('$path')</b> took $time ms (mode = ".(isset($stat['mode'])?sprintf('%o',$stat['mode']).' = '.egw_vfs::int2mode($stat['mode']):'NULL').')';