diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2011-04-17 15:59:06 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2011-04-17 15:59:06 +0200 |
commit | ee4d087e72ab9a91baf0681a5d4ee6582ba4fd37 (patch) | |
tree | 44ec735e0229cda9fc169f4306441d4a6fe99e14 /files/ajax | |
parent | 4b0a3163c8e7b89f51c130736cdb5fa98a934ded (diff) | |
download | nextcloud-server-ee4d087e72ab9a91baf0681a5d4ee6582ba4fd37.tar.gz nextcloud-server-ee4d087e72ab9a91baf0681a5d4ee6582ba4fd37.zip |
don't reload the whole page after file upload
Diffstat (limited to 'files/ajax')
-rw-r--r-- | files/ajax/list.php | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/files/ajax/list.php b/files/ajax/list.php index 4694f842832..ef43e72fcae 100644 --- a/files/ajax/list.php +++ b/files/ajax/list.php @@ -2,6 +2,7 @@ // Init owncloud require_once('../../lib/base.php'); +require_once('../../lib/template.php'); // We send json data header( "Content-Type: application/jsonrequest" ); @@ -14,23 +15,37 @@ if( !OC_USER::isLoggedIn()){ // Load the files $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; +$doBreadcrumb = isset( $_GET['breadcrumb'] ) ? true : false; +$data = array(); +// Make breadcrumb +if($doBreadcrumb){ + $breadcrumb = array(); + $pathtohere = "/"; + foreach( explode( "/", $dir ) as $i ){ + if( $i != "" ){ + $pathtohere .= "$i/"; + $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i ); + } + } + + $breadcrumbNav = new OC_TEMPLATE( "files", "part.breadcrumb", "" ); + $breadcrumbNav->assign( "breadcrumb", $breadcrumb ); + + $data['breadcrumb'] = $breadcrumbNav->fetchPage(); +} + +// make filelist $files = array(); foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){ - $i["date"] = date( $CONFIG_DATEFORMAT, $i["mtime"] ); + $i["date"] = OC_UTIL::formatDate($i["mtime"] ); $files[] = $i; } -// Make breadcrumb -$breadcrumb = array(); -$pathtohere = "/"; -foreach( explode( "/", $dir ) as $i ){ - if( $i != "" ){ - $pathtohere .= "$i/"; - $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i ); - } -} +$list = new OC_TEMPLATE( "files", "part.list", "" ); +$list->assign( "files", $files ); +$data = array('files' => $list->fetchPage()); -echo json_encode( array( "status" => "success", "data" => array( "files" => $files, "breadcrumb" => $breadcrumb ))); +echo json_encode( array( "status" => "success", "data" => $data)); ?> |