summaryrefslogtreecommitdiffstats
path: root/apps/files/index.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-09-07 15:42:37 +0200
committerBart Visscher <bartv@thisnet.nl>2012-09-07 15:51:44 +0200
commit5eba5798274823fe3147a8d671ca5e15b3eb7843 (patch)
treeeb9cfb3fc687b8be26dde07a08fd23ca3455991f /apps/files/index.php
parentb483f2aab856e3324026588a9702043072fd7ad2 (diff)
parent3829460ab8cbb6de65c53583a20fd04cbe7927dd (diff)
downloadnextcloud-server-5eba5798274823fe3147a8d671ca5e15b3eb7843.tar.gz
nextcloud-server-5eba5798274823fe3147a8d671ca5e15b3eb7843.zip
Merge branch 'master' into routing
Conflicts: apps/files/js/fileactions.js lib/base.php lib/helper.php lib/ocs.php
Diffstat (limited to 'apps/files/index.php')
-rw-r--r--apps/files/index.php24
1 files changed, 18 insertions, 6 deletions
diff --git a/apps/files/index.php b/apps/files/index.php
index ea5192629b7..9e788bffef5 100644
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -31,7 +31,7 @@ OCP\Util::addscript( 'files', 'jquery.fileupload' );
OCP\Util::addscript( 'files', 'files' );
OCP\Util::addscript( 'files', 'filelist' );
OCP\Util::addscript( 'files', 'fileactions' );
-if(!isset($_SESSION['timezone'])){
+if(!isset($_SESSION['timezone'])) {
OCP\Util::addscript( 'files', 'timezone' );
}
OCP\App::setActiveNavigationEntry( 'files_index' );
@@ -44,9 +44,9 @@ if(!OC_Filesystem::is_dir($dir.'/')) {
}
$files = array();
-foreach( OC_Files::getdirectorycontent( $dir ) as $i ){
+foreach( OC_Files::getdirectorycontent( $dir ) as $i ) {
$i['date'] = OCP\Util::formatDate($i['mtime'] );
- if($i['type']=='file'){
+ if($i['type']=='file') {
$fileinfo=pathinfo($i['name']);
$i['basename']=$fileinfo['filename'];
if (!empty($fileinfo['extension'])) {
@@ -56,7 +56,7 @@ foreach( OC_Files::getdirectorycontent( $dir ) as $i ){
$i['extension']='';
}
}
- if($i['directory']=='/'){
+ if($i['directory']=='/') {
$i['directory']='';
}
$files[] = $i;
@@ -65,8 +65,8 @@ foreach( OC_Files::getdirectorycontent( $dir ) as $i ){
// Make breadcrumb
$breadcrumb = array();
$pathtohere = '';
-foreach( explode( '/', $dir ) as $i ){
- if( $i != '' ){
+foreach( explode( '/', $dir ) as $i ) {
+ if( $i != '' ) {
$pathtohere .= '/'.str_replace('+','%20', urlencode($i));
$breadcrumb[] = array( 'dir' => $pathtohere, 'name' => $i );
}
@@ -89,11 +89,23 @@ $freeSpace=OC_Filesystem::free_space('/');
$freeSpace=max($freeSpace,0);
$maxUploadFilesize = min($maxUploadFilesize ,$freeSpace);
+$permissions = OCP\Share::PERMISSION_READ;
+if (OC_Filesystem::isUpdatable($dir.'/')) {
+ $permissions |= OCP\Share::PERMISSION_UPDATE;
+}
+if (OC_Filesystem::isDeletable($dir.'/')) {
+ $permissions |= OCP\Share::PERMISSION_DELETE;
+}
+if (OC_Filesystem::isSharable($dir.'/')) {
+ $permissions |= OCP\Share::PERMISSION_SHARE;
+}
+
$tmpl = new OCP\Template( 'files', 'index', 'user' );
$tmpl->assign( 'fileList', $list->fetchPage(), false );
$tmpl->assign( 'breadcrumb', $breadcrumbNav->fetchPage(), false );
$tmpl->assign( 'dir', OC_Filesystem::normalizePath($dir));
$tmpl->assign( 'isCreatable', OC_Filesystem::isCreatable($dir.'/'));
+$tmpl->assign('permissions', $permissions);
$tmpl->assign( 'files', $files );
$tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize);
$tmpl->assign( 'uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));