server/apps/files_trashbin/ajax/list.php
Thomas Müller 6ff96b34ad Merge branch 'master' into load-apps-proper-master
Conflicts:
	apps/files/ajax/rawlist.php
	cron.php
	ocs/v1.php
2014-03-21 14:05:08 +01:00

45 lines
1.3 KiB
PHP

<?php
OCP\JSON::checkLoggedIn();
// Load the files
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
$doBreadcrumb = isset( $_GET['breadcrumb'] ) ? true : false;
$data = array();
// Make breadcrumb
if($doBreadcrumb) {
$breadcrumb = \OCA\Files_Trashbin\Helper::makeBreadcrumb($dir);
$breadcrumbNav = new OCP\Template('files_trashbin', 'part.breadcrumb', '');
$breadcrumbNav->assign('breadcrumb', $breadcrumb, false);
$breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php') . '?dir=');
$breadcrumbNav->assign('home', OCP\Util::linkTo('files', 'index.php'));
$data['breadcrumb'] = $breadcrumbNav->fetchPage();
}
// make filelist
try {
$files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir);
} catch (Exception $e) {
header("HTTP/1.0 404 Not Found");
exit();
}
$dirlisting = false;
if ($dir && $dir !== '/') {
$dirlisting = true;
}
$encodedDir = \OCP\Util::encodePath($dir);
$list = new OCP\Template('files_trashbin', 'part.list', '');
$list->assign('files', $files, false);
$list->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php'). '?dir='.$encodedDir);
$list->assign('downloadURL', OCP\Util::linkToRoute('download', array('file' => '/')));
$list->assign('dirlisting', $dirlisting);
$list->assign('disableDownloadActions', true);
$data['files'] = $list->fetchPage();
OCP\JSON::success(array('data' => $data));