diff options
author | Vincent Petry <pvince81@owncloud.com> | 2013-08-17 13:07:18 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2013-09-13 19:59:14 +0200 |
commit | 1304b511e9533dee4cf1125e625568c8a74719a1 (patch) | |
tree | 2430ff5abeeb0f378547e49cb4b311b41c035421 /apps/files_trashbin/ajax | |
parent | c149b57d3b4020c65d33966d5dc8395b8b821fc9 (diff) | |
download | nextcloud-server-1304b511e9533dee4cf1125e625568c8a74719a1.tar.gz nextcloud-server-1304b511e9533dee4cf1125e625568c8a74719a1.zip |
Ajax calls for "files" and "files_trashbin" apps
Frontend:
- The files app list now uses ajax calls to refresh the list.
- Added support the browser back button (history API).
- Added mask + spinner while loading file list
Backend:
- Added utility function in core JS for parsing query strings.
- Moved file list + breadcrumb template data code to helper
functions
- Fixed some file paths in trashbin app to be similar to the files app
Diffstat (limited to 'apps/files_trashbin/ajax')
-rw-r--r-- | apps/files_trashbin/ajax/list.php | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/apps/files_trashbin/ajax/list.php b/apps/files_trashbin/ajax/list.php new file mode 100644 index 00000000000..e72e67b01d7 --- /dev/null +++ b/apps/files_trashbin/ajax/list.php @@ -0,0 +1,51 @@ +<?php + +// only need filesystem apps +$RUNTIME_APPTYPES=array('filesystem'); + +// Init owncloud + + +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\lib\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 +$files = \OCA\files_trashbin\lib\Helper::getTrashFiles($dir); + +if ($files === null){ + 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)); + |