2011-03-03 22:08:54 +00:00
|
|
|
<?php
|
|
|
|
|
2012-03-30 12:39:07 +00:00
|
|
|
// only need filesystem apps
|
|
|
|
$RUNTIME_APPTYPES=array('filesystem');
|
|
|
|
|
2011-03-03 22:08:54 +00:00
|
|
|
// Init owncloud
|
2012-04-17 17:31:29 +00:00
|
|
|
|
2011-03-03 22:08:54 +00:00
|
|
|
|
2012-05-03 10:23:29 +00:00
|
|
|
OCP\JSON::checkLoggedIn();
|
2011-03-03 22:08:54 +00:00
|
|
|
|
|
|
|
// Load the files
|
|
|
|
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
|
2013-08-17 21:38:26 +00:00
|
|
|
$doBreadcrumb = isset($_GET['breadcrumb']);
|
2011-04-17 13:59:06 +00:00
|
|
|
$data = array();
|
2011-03-03 22:08:54 +00:00
|
|
|
|
2011-04-17 13:59:06 +00:00
|
|
|
// Make breadcrumb
|
2012-08-28 22:50:12 +00:00
|
|
|
if($doBreadcrumb) {
|
2011-04-17 13:59:06 +00:00
|
|
|
$breadcrumb = array();
|
|
|
|
$pathtohere = "/";
|
2012-09-07 13:22:01 +00:00
|
|
|
foreach( explode( "/", $dir ) as $i ) {
|
2012-08-28 22:50:12 +00:00
|
|
|
if( $i != "" ) {
|
2011-04-17 13:59:06 +00:00
|
|
|
$pathtohere .= "$i/";
|
|
|
|
$breadcrumb[] = array( "dir" => $pathtohere, "name" => $i );
|
|
|
|
}
|
|
|
|
}
|
2012-08-29 06:42:49 +00:00
|
|
|
|
2012-05-06 21:00:36 +00:00
|
|
|
$breadcrumbNav = new OCP\Template( "files", "part.breadcrumb", "" );
|
2012-11-16 11:58:24 +00:00
|
|
|
$breadcrumbNav->assign( "breadcrumb", $breadcrumb, false );
|
2012-08-29 06:42:49 +00:00
|
|
|
|
2011-04-17 13:59:06 +00:00
|
|
|
$data['breadcrumb'] = $breadcrumbNav->fetchPage();
|
|
|
|
}
|
|
|
|
|
|
|
|
// make filelist
|
2011-03-03 22:08:54 +00:00
|
|
|
$files = array();
|
2012-10-26 21:05:02 +00:00
|
|
|
foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $i ) {
|
2012-05-01 19:07:08 +00:00
|
|
|
$i["date"] = OCP\Util::formatDate($i["mtime"] );
|
2011-03-03 22:08:54 +00:00
|
|
|
$files[] = $i;
|
|
|
|
}
|
|
|
|
|
2012-05-06 21:00:36 +00:00
|
|
|
$list = new OCP\Template( "files", "part.list", "" );
|
2012-06-11 17:07:51 +00:00
|
|
|
$list->assign( "files", $files, false );
|
2011-04-17 13:59:06 +00:00
|
|
|
$data = array('files' => $list->fetchPage());
|
2011-03-03 22:08:54 +00:00
|
|
|
|
2012-05-03 10:23:29 +00:00
|
|
|
OCP\JSON::success(array('data' => $data));
|