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/index.php | |
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/index.php')
-rw-r--r-- | apps/files/index.php | 42 |
1 files changed, 3 insertions, 39 deletions
diff --git a/apps/files/index.php b/apps/files/index.php index 4443bf5fde0..ec824f895b6 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -41,62 +41,25 @@ if (!\OC\Files\Filesystem::is_dir($dir . '/')) { exit(); } -function fileCmp($a, $b) { - if ($a['type'] == 'dir' and $b['type'] != 'dir') { - return -1; - } elseif ($a['type'] != 'dir' and $b['type'] == 'dir') { - return 1; - } else { - return strnatcasecmp($a['name'], $b['name']); - } -} - $files = array(); $user = OC_User::getUser(); if (\OC\Files\Cache\Upgrade::needUpgrade($user)) { //dont load anything if we need to upgrade the cache - $content = array(); $needUpgrade = true; $freeSpace = 0; } else { - $content = \OC\Files\Filesystem::getDirectoryContent($dir); + $files = \OCA\files\lib\Helper::getFiles($dir); $freeSpace = \OC\Files\Filesystem::free_space($dir); $needUpgrade = false; } -foreach ($content as $i) { - $i['date'] = OCP\Util::formatDate($i['mtime']); - if ($i['type'] == 'file') { - $fileinfo = pathinfo($i['name']); - $i['basename'] = $fileinfo['filename']; - if (!empty($fileinfo['extension'])) { - $i['extension'] = '.' . $fileinfo['extension']; - } else { - $i['extension'] = ''; - } - } - $i['directory'] = $dir; - $i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($i['mimetype']); - $i['icon'] = \OCA\files\lib\Helper::determineIcon($i); - $files[] = $i; -} - -usort($files, "fileCmp"); // Make breadcrumb -$breadcrumb = array(); -$pathtohere = ''; -foreach (explode('/', $dir) as $i) { - if ($i != '') { - $pathtohere .= '/' . $i; - $breadcrumb[] = array('dir' => $pathtohere, 'name' => $i); - } -} +$breadcrumb = \OCA\files\lib\Helper::makeBreadcrumb($dir); // make breadcrumb und filelist markup $list = new OCP\Template('files', 'part.list', ''); $list->assign('files', $files); $list->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir='); $list->assign('downloadURL', OCP\Util::linkToRoute('download', array('file' => '/'))); -$list->assign('disableSharing', false); $list->assign('isPublic', false); $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', ''); $breadcrumbNav->assign('breadcrumb', $breadcrumb); @@ -154,5 +117,6 @@ if ($needUpgrade) { $tmpl->assign('isPublic', false); $tmpl->assign('publicUploadEnabled', $publicUploadEnabled); $tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles()); + $tmpl->assign('disableSharing', false); $tmpl->printPage(); } |