summaryrefslogtreecommitdiffstats
path: root/apps/files/index.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-05-08 22:06:30 +0200
committerVincent Petry <pvince81@owncloud.com>2014-05-15 17:51:04 +0200
commit9d38e3602b2faf37d861729c52690ce51b8fee97 (patch)
tree5da63d26db4a4e8ec356dee45fc8f7804c6fe38a /apps/files/index.php
parentfb10bf4048aaf5b2a9665fc9dff217c790efe005 (diff)
downloadnextcloud-server-9d38e3602b2faf37d861729c52690ce51b8fee97.tar.gz
nextcloud-server-9d38e3602b2faf37d861729c52690ce51b8fee97.zip
Namespacing for FileList, FileActions and trashbin app
- FileList is now an instantiable class - FileActions is now in namespace - added App class for trashbin app - moved trashbin overrides into classes extending FileList - replaced many static calls with "this." or "self." to make the classes reusable/extendable - new URL parameter "view" to specify which view is shown, for example "files" or "trashbin" - added OC.Util.History utility class in core for handling history - moved URL handling/routing to OCA.Files.App - popstate will correctly update the current view and notify the view of the URL change so it can update the current dir - added JS unitt tests for the trashbin app - fixed public app to work with the new namespaces
Diffstat (limited to 'apps/files/index.php')
-rw-r--r--apps/files/index.php46
1 files changed, 11 insertions, 35 deletions
diff --git a/apps/files/index.php b/apps/files/index.php
index 07c828fffef..69fa1c19131 100644
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -38,28 +38,23 @@ OCP\Util::addscript('files', 'breadcrumb');
OCP\Util::addscript('files', 'filelist');
OCP\App::setActiveNavigationEntry('files_index');
-// Load the files
-$dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : '';
-$dir = \OC\Files\Filesystem::normalizePath($dir);
-$dirInfo = \OC\Files\Filesystem::getFileInfo($dir, false);
-// Redirect if directory does not exist
-if (!$dirInfo || !$dirInfo->getType() === 'dir') {
- header('Location: ' . OCP\Util::getScriptName() . '');
- exit();
-}
$isIE8 = false;
preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
-if (count($matches) > 0 && $matches[1] <= 8){
+if (count($matches) > 0 && $matches[1] <= 9) {
$isIE8 = true;
}
-// if IE8 and "?dir=path" was specified, reformat the URL to use a hash like "#?dir=path"
-if ($isIE8 && isset($_GET['dir'])){
- if ($dir === ''){
- $dir = '/';
+// if IE8 and "?dir=path&view=someview" was specified, reformat the URL to use a hash like "#?dir=path&view=someview"
+if ($isIE8 && (isset($_GET['dir']) || isset($_GET['view']))) {
+ $hash = '#?';
+ $dir = isset($_GET['dir']) ? $_GET['dir'] : '/';
+ $view = isset($_GET['view']) ? $_GET['view'] : 'files';
+ $hash = '#?dir=' . \OCP\Util::encodePath($dir);
+ if ($view !== 'files') {
+ $hash .= '&view=' . urlencode($view);
}
- header('Location: ' . OCP\Util::linkTo('files', 'index.php') . '#?dir=' . \OCP\Util::encodePath($dir));
+ header('Location: ' . OCP\Util::linkTo('files', 'index.php') . $hash);
exit();
}
@@ -67,16 +62,6 @@ $user = OC_User::getUser();
$config = \OC::$server->getConfig();
-// needed for share init, permissions will be reloaded
-// anyway with ajax load
-$permissions = $dirInfo->getPermissions();
-
-// information about storage capacities
-$storageInfo=OC_Helper::getStorageInfo($dir, $dirInfo);
-$freeSpace=$storageInfo['free'];
-$uploadLimit=OCP\Util::uploadLimit();
-$maxUploadFilesize=OCP\Util::maxUploadFilesize($dir, $freeSpace);
-$publicUploadEnabled = $config->getAppValue('core', 'shareapi_allow_public_upload', 'yes');
// if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code)
$encryptionInitStatus = 2;
if (OC_App::isEnabled('files_encryption')) {
@@ -105,6 +90,7 @@ function renderScript($appName, $scriptName) {
return $content;
}
+// render the container content for every navigation item
foreach ($navItems as $item) {
$content = '';
if (isset($item['script'])) {
@@ -121,21 +107,11 @@ OCP\Util::addscript('files', 'files');
OCP\Util::addscript('files', 'navigation');
OCP\Util::addscript('files', 'keyboardshortcuts');
$tmpl = new OCP\Template('files', 'index', 'user');
-$tmpl->assign('dir', $dir);
-$tmpl->assign('permissions', $permissions);
-$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); // minimium of freeSpace and uploadLimit
-$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
-$tmpl->assign('freeSpace', $freeSpace);
-$tmpl->assign('uploadLimit', $uploadLimit); // PHP upload limit
-$tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
-$tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']);
$tmpl->assign('isPublic', false);
-$tmpl->assign('publicUploadEnabled', $publicUploadEnabled);
$tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles());
$tmpl->assign("mailNotificationEnabled", $config->getAppValue('core', 'shareapi_allow_mail_notification', 'yes'));
$tmpl->assign("allowShareWithLink", $config->getAppValue('core', 'shareapi_allow_links', 'yes'));
$tmpl->assign("encryptionInitStatus", $encryptionInitStatus);
-$tmpl->assign('disableSharing', false);
$tmpl->assign('appNavigation', $nav);
$tmpl->assign('appContents', $contentItems);