diff options
author | Björn Schießle <schiessle@owncloud.com> | 2013-01-21 13:07:43 +0100 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2013-01-22 15:33:54 +0100 |
commit | 1817c7895b3db5643d255ba54cf062c3f90885ed (patch) | |
tree | 2ee172b8127387e50030dc13412990c2e6fd01f1 /apps/files_trashbin | |
parent | 1255791ef2535aac96889f6be8c8b5b163b45be6 (diff) | |
download | nextcloud-server-1817c7895b3db5643d255ba54cf062c3f90885ed.tar.gz nextcloud-server-1817c7895b3db5643d255ba54cf062c3f90885ed.zip |
allow to look into deleted directories
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r-- | apps/files_trashbin/index.php | 48 | ||||
-rw-r--r-- | apps/files_trashbin/templates/part.list.php | 13 |
2 files changed, 55 insertions, 6 deletions
diff --git a/apps/files_trashbin/index.php b/apps/files_trashbin/index.php index 28414cc1ce9..2925223197b 100644 --- a/apps/files_trashbin/index.php +++ b/apps/files_trashbin/index.php @@ -14,8 +14,37 @@ $view = new OC_Filesystemview('/'.$user.'/files_trashbin'); OCP\Util::addStyle('files', 'files'); OCP\Util::addScript('files', 'filelist'); -$query = \OC_DB::prepare('SELECT id,location,timestamp,type,mime FROM *PREFIX*files_trash WHERE user=?'); -$result = $query->execute(array($user))->fetchAll(); +$dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : ''; + +if ($dir) { + $dirlisting = true; + $view = new \OC_FilesystemView('/'.\OCP\User::getUser().'/files_trashbin');
+ $fullpath = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath($dir); + $dirContent = opendir($fullpath); + $i = 0; + while($entryName = readdir($dirContent)) { + if ( $entryName != '.' && $entryName != '..' ) { + $pos = strpos($dir.'/', '/', 1); + $tmp = substr($dir, 0, $pos); + $pos = strrpos($tmp, '.d'); + $timestamp = substr($tmp,$pos+2); + error_log("timestamp: $timestamp"); + $result[] = array( + 'id' => $entryName, + 'timestamp' => $timestamp, + 'mime' => $view->getMimeType($dir.'/'.$entryName), + 'type' => $view->is_dir($dir.'/'.$entryName) ? 'dir' : 'file', + 'location' => $dir, + ); + }
+ } + closedir($fullpath); + +} else { + $dirlisting = false; + $query = \OC_DB::prepare('SELECT id,location,timestamp,type,mime FROM *PREFIX*files_trash WHERE user=?'); + $result = $query->execute(array($user))->fetchAll(); +} $files = array(); foreach ($result as $r) { @@ -38,15 +67,26 @@ foreach ($result as $r) { $files[] = $i; } +// Make breadcrumb
+$breadcrumb = array('dir' => '', 'name' => 'Trash');
+$pathtohere = '';
+foreach (explode('/', $dir) as $i) {
+ if ($i != '') {
+ $pathtohere .= '/' . $i;
+ $breadcrumb[] = array('dir' => $pathtohere, 'name' => $i);
+ }
+} + $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
$breadcrumbNav->assign('breadcrumb', array(array('dir' => '', 'name' => 'Trash')), false);
$breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php') . '?dir=', false); $list = new OCP\Template('files_trashbin', 'part.list', ''); $list->assign('files', $files, false); -$list->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php'). '?dir=', false);
-$list->assign('downloadURL', OCP\Util::linkTo('files_trashbin', 'download.php') . '?file=', false); +$list->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php'). '?dir='.$dir, false);
+$list->assign('downloadURL', OCP\Util::linkTo('files_trashbin', 'download.php') . '?file='.$dir, false); $list->assign('disableSharing', true); +$list->assign('dirlisting', $dirlisting); $list->assign('disableDownloadActions', true); $tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage(), false); $tmpl->assign('fileList', $list->fetchPage(), false); diff --git a/apps/files_trashbin/templates/part.list.php b/apps/files_trashbin/templates/part.list.php index c9a641a2e23..72359da299c 100644 --- a/apps/files_trashbin/templates/part.list.php +++ b/apps/files_trashbin/templates/part.list.php @@ -40,9 +40,17 @@ > <?php if(!isset($_['readonly']) || !$_['readonly']): ?><input type="checkbox" /><?php endif; ?> <?php if($file['type'] == 'dir'): ?> - <a class="name" href="<?php $_['baseURL'].'/'.$name.'.d'.$file['timestamp']; ?>)" title=""> + <?php if( $_['dirlisting'] ): ?> + <a class="name" href="<?php echo $_['baseURL'].'/'.$name; ?>" title=""> + <?php else: ?> + <a class="name" href="<?php echo $_['baseURL'].'/'.$name.'.d'.$file['timestamp']; ?>" title=""> + <?php endif; ?> <?php else: ?> - <a class="name" href="<?php echo $_['downloadURL'].'/'.$name.'.d'.$file['timestamp']; ?>" title=""> + <?php if( $_['dirlisting'] ): ?> + <a class="name" href="<?php echo $_['downloadURL'].'/'.$name; ?>" title=""> + <?php else: ?> + <a class="name" href="<?php echo $_['downloadURL'].'/'.$name.'.d'.$file['timestamp'];?>" title=""> + <?php endif; ?> <?php endif; ?> <span class="nametext"> <?php if($file['type'] == 'dir'):?> @@ -69,3 +77,4 @@ </td> </tr> <?php endforeach; +
\ No newline at end of file |