diff options
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r-- | apps/files_trashbin/ajax/list.php | 29 | ||||
-rw-r--r-- | apps/files_trashbin/ajax/preview.php | 2 | ||||
-rw-r--r-- | apps/files_trashbin/ajax/undelete.php | 2 | ||||
-rw-r--r-- | apps/files_trashbin/css/trash.css | 3 | ||||
-rw-r--r-- | apps/files_trashbin/index.php | 42 | ||||
-rw-r--r-- | apps/files_trashbin/js/disableDefaultActions.js | 1 | ||||
-rw-r--r-- | apps/files_trashbin/js/filelist.js | 137 | ||||
-rw-r--r-- | apps/files_trashbin/js/trash.js | 114 | ||||
-rw-r--r-- | apps/files_trashbin/lib/helper.php | 83 | ||||
-rw-r--r-- | apps/files_trashbin/templates/index.php | 9 | ||||
-rw-r--r-- | apps/files_trashbin/templates/part.breadcrumb.php | 19 | ||||
-rw-r--r-- | apps/files_trashbin/templates/part.list.php | 79 |
12 files changed, 187 insertions, 333 deletions
diff --git a/apps/files_trashbin/ajax/list.php b/apps/files_trashbin/ajax/list.php index cec18c46525..89a55114524 100644 --- a/apps/files_trashbin/ajax/list.php +++ b/apps/files_trashbin/ajax/list.php @@ -4,21 +4,8 @@ OCP\JSON::checkLoggedIn(); // Load the files $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; -$doBreadcrumb = isset( $_GET['breadcrumb'] ) ? true : false; $data = array(); -// Make breadcrumb -if($doBreadcrumb) { - $breadcrumb = \OCA\Files_Trashbin\Helper::makeBreadcrumb($dir); - - $breadcrumbNav = new OCP\Template('files_trashbin', 'part.breadcrumb', ''); - $breadcrumbNav->assign('breadcrumb', $breadcrumb, false); - $breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php') . '?dir='); - $breadcrumbNav->assign('home', OCP\Util::linkTo('files', 'index.php')); - - $data['breadcrumb'] = $breadcrumbNav->fetchPage(); -} - // make filelist try { $files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir); @@ -27,19 +14,11 @@ try { exit(); } -$dirlisting = false; -if ($dir && $dir !== '/') { - $dirlisting = true; -} - $encodedDir = \OCP\Util::encodePath($dir); -$list = new OCP\Template('files_trashbin', 'part.list', ''); -$list->assign('files', $files, false); -$list->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php'). '?dir='.$encodedDir); -$list->assign('downloadURL', OCP\Util::linkToRoute('download', array('file' => '/'))); -$list->assign('dirlisting', $dirlisting); -$list->assign('disableDownloadActions', true); -$data['files'] = $list->fetchPage(); + +$data['permissions'] = 0; +$data['directory'] = $dir; +$data['files'] = \OCA\Files_Trashbin\Helper::formatFileInfos($files); OCP\JSON::success(array('data' => $data)); diff --git a/apps/files_trashbin/ajax/preview.php b/apps/files_trashbin/ajax/preview.php index ce64d9ecc9f..32905b2a71c 100644 --- a/apps/files_trashbin/ajax/preview.php +++ b/apps/files_trashbin/ajax/preview.php @@ -34,7 +34,7 @@ try{ if ($view->is_dir($file)) { $mimetype = 'httpd/unix-directory'; } else { - $pathInfo = pathinfo($file); + $pathInfo = pathinfo(ltrim($file, '/')); $fileName = $pathInfo['basename']; // if in root dir if ($pathInfo['dirname'] === '.') { diff --git a/apps/files_trashbin/ajax/undelete.php b/apps/files_trashbin/ajax/undelete.php index 9c3ccba7ed8..2b00078669e 100644 --- a/apps/files_trashbin/ajax/undelete.php +++ b/apps/files_trashbin/ajax/undelete.php @@ -19,7 +19,7 @@ if (isset($_POST['allfiles']) and $_POST['allfiles'] === 'true') { foreach (OCA\Files_Trashbin\Helper::getTrashFiles($dir) as $file) { $fileName = $file['name']; if (!$dirListing) { - $fileName .= '.d' . $file['timestamp']; + $fileName .= '.d' . $file['mtime']; } $list[] = $fileName; } diff --git a/apps/files_trashbin/css/trash.css b/apps/files_trashbin/css/trash.css index 97819f4e80b..7ca3e355fc2 100644 --- a/apps/files_trashbin/css/trash.css +++ b/apps/files_trashbin/css/trash.css @@ -1,3 +1,4 @@ -#fileList td a.file, #fileList td a.file span { +#fileList tr[data-type="file"] td a.name, +#fileList tr[data-type="file"] td a.name span { cursor: default; } diff --git a/apps/files_trashbin/index.php b/apps/files_trashbin/index.php index f0c5b0508b8..e63fe1e4188 100644 --- a/apps/files_trashbin/index.php +++ b/apps/files_trashbin/index.php @@ -11,6 +11,7 @@ $tmpl = new OCP\Template('files_trashbin', 'index', 'user'); OCP\Util::addStyle('files', 'files'); OCP\Util::addStyle('files_trashbin', 'trash'); +OCP\Util::addScript('files', 'breadcrumb'); OCP\Util::addScript('files', 'filelist'); // filelist overrides OCP\Util::addScript('files_trashbin', 'filelist'); @@ -34,48 +35,7 @@ if ($isIE8 && isset($_GET['dir'])){ exit(); } -$ajaxLoad = false; - -if (!$isIE8){ - try { - $files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir); - } catch (Exception $e) { - header('Location: ' . OCP\Util::linkTo('files_trashbin', 'index.php')); - exit(); - } -} -else{ - $files = array(); - $ajaxLoad = true; -} - -$dirlisting = false; -if ($dir && $dir !== '/') { - $dirlisting = true; -} - -$breadcrumb = \OCA\Files_Trashbin\Helper::makeBreadcrumb($dir); - -$breadcrumbNav = new OCP\Template('files_trashbin', 'part.breadcrumb', ''); -$breadcrumbNav->assign('breadcrumb', $breadcrumb); -$breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php') . '?dir='); -$breadcrumbNav->assign('home', OCP\Util::linkTo('files', 'index.php')); - -$list = new OCP\Template('files_trashbin', 'part.list', ''); -$list->assign('files', $files); - -$encodedDir = \OCP\Util::encodePath($dir); -$list->assign('baseURL', OCP\Util::linkTo('files_trashbin', 'index.php'). '?dir='.$encodedDir); -$list->assign('downloadURL', OCP\Util::linkTo('files_trashbin', 'download.php') . '?file='.$encodedDir); -$list->assign('dirlisting', $dirlisting); -$list->assign('disableDownloadActions', true); - -$tmpl->assign('dirlisting', $dirlisting); -$tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage()); -$tmpl->assign('fileList', $list->fetchPage()); -$tmpl->assign('files', $files); $tmpl->assign('dir', $dir); $tmpl->assign('disableSharing', true); -$tmpl->assign('ajaxLoad', true); $tmpl->printPage(); diff --git a/apps/files_trashbin/js/disableDefaultActions.js b/apps/files_trashbin/js/disableDefaultActions.js index afa80cacd6b..50ceaf4696f 100644 --- a/apps/files_trashbin/js/disableDefaultActions.js +++ b/apps/files_trashbin/js/disableDefaultActions.js @@ -1,4 +1,3 @@ /* disable download and sharing actions */ var disableDownloadActions = true; -var disableSharing = true; var trashBinApp = true; diff --git a/apps/files_trashbin/js/filelist.js b/apps/files_trashbin/js/filelist.js index a88459b0a9a..7795daf2775 100644 --- a/apps/files_trashbin/js/filelist.js +++ b/apps/files_trashbin/js/filelist.js @@ -1,61 +1,78 @@ -/* globals OC, FileList, t */ -// override reload with own ajax call -FileList.reload = function(){ - FileList.showMask(); - if (FileList._reloadCall){ - FileList._reloadCall.abort(); - } - $.ajax({ - url: OC.filePath('files_trashbin','ajax','list.php'), - data: { - dir : $('#dir').val(), - breadcrumb: true - }, - error: function(result) { - FileList.reloadCallback(result); - }, - success: function(result) { - FileList.reloadCallback(result); +/* global OC, t, FileList */ +(function() { + FileList.appName = t('files_trashbin', 'Deleted files'); + + FileList._deletedRegExp = new RegExp(/^(.+)\.d[0-9]+$/); + + /** + * Convert a file name in the format filename.d12345 to the real file name. + * This will use basename. + * The name will not be changed if it has no ".d12345" suffix. + * @param name file name + * @return converted file name + */ + FileList.getDeletedFileName = function(name) { + name = OC.basename(name); + var match = FileList._deletedRegExp.exec(name); + if (match && match.length > 1) { + name = match[1]; } - }); -}; - -FileList.appName = t('files_trashbin', 'Deleted files'); - -FileList._deletedRegExp = new RegExp(/^(.+)\.d[0-9]+$/); - -/** - * Convert a file name in the format filename.d12345 to the real file name. - * This will use basename. - * The name will not be changed if it has no ".d12345" suffix. - * @param name file name - * @return converted file name - */ -FileList.getDeletedFileName = function(name) { - name = OC.basename(name); - var match = FileList._deletedRegExp.exec(name); - if (match && match.length > 1) { - name = match[1]; - } - return name; -}; -var oldSetCurrentDir = FileList.setCurrentDir; -FileList.setCurrentDir = function(targetDir) { - oldSetCurrentDir.apply(this, arguments); - - var baseDir = OC.basename(targetDir); - if (baseDir !== '') { - FileList.setPageTitle(FileList.getDeletedFileName(baseDir)); - } -}; - -FileList.linkTo = function(dir){ - return OC.linkTo('files_trashbin', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/'); -} - -FileList.updateEmptyContent = function(){ - var $fileList = $('#fileList'); - var exists = $fileList.find('tr:first').exists(); - $('#emptycontent').toggleClass('hidden', exists); - $('#filestable th').toggleClass('hidden', !exists); -} + return name; + }; + + var oldSetCurrentDir = FileList._setCurrentDir; + FileList._setCurrentDir = function(targetDir) { + oldSetCurrentDir.apply(this, arguments); + + var baseDir = OC.basename(targetDir); + if (baseDir !== '') { + FileList.setPageTitle(FileList.getDeletedFileName(baseDir)); + } + }; + + var oldCreateRow = FileList._createRow; + FileList._createRow = function() { + // FIXME: MEGAHACK until we find a better solution + var tr = oldCreateRow.apply(this, arguments); + tr.find('td.filesize').remove(); + return tr; + }; + + FileList._onClickBreadCrumb = function(e) { + var $el = $(e.target).closest('.crumb'), + index = $el.index(), + $targetDir = $el.data('dir'); + // first one is home, let the link makes it default action + if (index !== 0) { + e.preventDefault(); + FileList.changeDirectory($targetDir); + } + }; + + var oldAdd = FileList.add; + FileList.add = function(fileData, options) { + options = options || {}; + var dir = FileList.getCurrentDirectory(); + var dirListing = dir !== '' && dir !== '/'; + // show deleted time as mtime + if (fileData.mtime) { + fileData.mtime = parseInt(fileData.mtime, 10); + } + if (!dirListing) { + fileData.displayName = fileData.name; + fileData.name = fileData.name + '.d' + Math.floor(fileData.mtime / 1000); + } + return oldAdd.call(this, fileData, options); + }; + + FileList.linkTo = function(dir){ + return OC.linkTo('files_trashbin', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/'); + }; + + FileList.updateEmptyContent = function(){ + var $fileList = $('#fileList'); + var exists = $fileList.find('tr:first').exists(); + $('#emptycontent').toggleClass('hidden', exists); + $('#filestable th').toggleClass('hidden', !exists); + }; +})(); diff --git a/apps/files_trashbin/js/trash.js b/apps/files_trashbin/js/trash.js index efe1e89f0bf..5cd49e19aaa 100644 --- a/apps/files_trashbin/js/trash.js +++ b/apps/files_trashbin/js/trash.js @@ -8,9 +8,26 @@ * */ -/* global OC, t, FileList, FileActions */ - +/* global OC, t, BreadCrumb, FileActions, FileList, Files */ $(document).ready(function() { + var deletedRegExp = new RegExp(/^(.+)\.d[0-9]+$/); + + /** + * Convert a file name in the format filename.d12345 to the real file name. + * This will use basename. + * The name will not be changed if it has no ".d12345" suffix. + * @param name file name + * @return converted file name + */ + function getDeletedFileName(name) { + name = OC.basename(name); + var match = deletedRegExp.exec(name); + if (match && match.length > 1) { + name = match[1]; + } + return name; + } + function removeCallback(result) { if (result.status !== 'success') { OC.dialogs.alert(result.data.message, t('core', 'Error')); @@ -18,7 +35,7 @@ $(document).ready(function() { var files = result.data.success; for (var i = 0; i < files.length; i++) { - FileList.findFileEl(OC.basename(files[i].filename)).remove(); + FileList.remove(OC.basename(files[i].filename), {updateSummary: false}); } FileList.updateFileSummary(); FileList.updateEmptyContent(); @@ -74,7 +91,6 @@ $(document).ready(function() { } procesSelection(); }); - $('.undelete').click('click', function(event) { event.preventDefault(); var allFiles = $('#select_all').is(':checked'); @@ -89,7 +105,7 @@ $(document).ready(function() { }; } else { - files = getSelectedFiles('name'); + files = Files.getSelectedFiles('name'); for (var i = 0; i < files.length; i++) { var deleteAction = FileList.findFileEl(files[i]).children("td.date").children(".action.delete"); deleteAction.removeClass('delete-icon').addClass('progress-icon'); @@ -131,7 +147,7 @@ $(document).ready(function() { }; } else { - files = getSelectedFiles('name'); + files = Files.getSelectedFiles('name'); params = { files: JSON.stringify(files), dir: FileList.getCurrentDirectory() @@ -158,7 +174,7 @@ $(document).ready(function() { } FileList.hideMask(); // simply remove all files - FileList.update(''); + FileList.setFiles([]); enableActions(); } else { @@ -191,7 +207,7 @@ $(document).ready(function() { var filename = $(this).parent().parent().attr('data-file'); var tr = FileList.findFileEl(filename); var renaming = tr.data('renaming'); - if(!renaming && !FileList.isLoading(filename)){ + if(!renaming){ if(mime.substr(0, 5) === 'text/'){ //no texteditor for now return; } @@ -203,47 +219,61 @@ $(document).ready(function() { action(filename); } } - - // event handlers for breadcrumb items - $('#controls').delegate('.crumb:not(.home) a', 'click', onClickBreadcrumb); }); - FileActions.actions.dir = { - // only keep 'Open' action for navigation - 'Open': FileActions.actions.dir.Open + /** + * Override crumb URL maker (hacky!) + */ + FileList.breadcrumb.getCrumbUrl = function(part, index) { + if (index === 0) { + return OC.linkTo('files', 'index.php'); + } + return OC.linkTo('files_trashbin', 'index.php')+"?dir=" + encodeURIComponent(part.dir); }; -}); -/** - * @brief get a list of selected files - * @param string property (option) the property of the file requested - * @return array - * - * possible values for property: name, mime, size and type - * if property is set, an array with that property for each file is returnd - * if it's ommited an array of objects with all properties is returned - */ -function getSelectedFiles(property){ - var elements=$('td.filename input:checkbox:checked').parent().parent(); - var files=[]; - elements.each(function(i,element){ - var file={ - name:$(element).attr('data-file'), - timestamp:$(element).attr('data-timestamp'), - type:$(element).attr('data-type') + Files.generatePreviewUrl = function(urlSpec) { + return OC.generateUrl('/apps/files_trashbin/ajax/preview.php?') + $.param(urlSpec); + }; + + Files.getDownloadUrl = function(action, params) { + // no downloads + return '#'; + }; + + Files.getAjaxUrl = function(action, params) { + var q = ''; + if (params) { + q = '?' + OC.buildQueryString(params); + } + return OC.filePath('files_trashbin', 'ajax', action + '.php') + q; + }; + + + /** + * Override crumb making to add "Deleted Files" entry + * and convert files with ".d" extensions to a more + * user friendly name. + */ + var oldMakeCrumbs = BreadCrumb.prototype._makeCrumbs; + BreadCrumb.prototype._makeCrumbs = function() { + var parts = oldMakeCrumbs.apply(this, arguments); + // duplicate first part + parts.unshift(parts[0]); + parts[1] = { + dir: '/', + name: t('files_trashbin', 'Deleted Files') }; - if(property){ - files.push(file[property]); - }else{ - files.push(file); + for (var i = 2; i < parts.length; i++) { + parts[i].name = getDeletedFileName(parts[i].name); } - }); - return files; -} + return parts; + }; -function fileDownloadPath(dir, file) { - return OC.filePath('files_trashbin', '', 'download.php') + '?file='+encodeURIComponent(file); -} + FileActions.actions.dir = { + // only keep 'Open' action for navigation + 'Open': FileActions.actions.dir.Open + }; +}); function enableActions() { $(".action").css("display", "inline"); diff --git a/apps/files_trashbin/lib/helper.php b/apps/files_trashbin/lib/helper.php index 9c24332a964..e6ca73520a6 100644 --- a/apps/files_trashbin/lib/helper.php +++ b/apps/files_trashbin/lib/helper.php @@ -27,6 +27,10 @@ class Helper if ($dirContent === false) { return $result; } + + list($storage, $internalPath) = $view->resolvePath($dir); + $absoluteDir = $view->getAbsolutePath($dir); + if (is_resource($dirContent)) { while (($entryName = readdir($dirContent)) !== false) { if (!\OC\Files\Filesystem::isIgnoredDir($entryName)) { @@ -40,76 +44,41 @@ class Helper $parts = explode('/', ltrim($dir, '/')); $timestamp = substr(pathinfo($parts[0], PATHINFO_EXTENSION), 1); } - $result[] = array( - 'id' => $id, - 'timestamp' => $timestamp, - 'mime' => \OC_Helper::getFileNameMimeType($id), + $i = array( + 'name' => $id, + 'mtime' => $timestamp, + 'mimetype' => \OC_Helper::getFileNameMimeType($id), 'type' => $view->is_dir($dir . '/' . $entryName) ? 'dir' : 'file', - 'location' => $dir, + 'directory' => ($dir === '/') ? '' : $dir, ); + $result[] = new FileInfo($absoluteDir . '/' . $i['name'], $storage, $internalPath . '/' . $i['name'], $i); } } closedir($dirContent); } - $files = array(); - $id = 0; - list($storage, $internalPath) = $view->resolvePath($dir); - $absoluteDir = $view->getAbsolutePath($dir); - foreach ($result as $r) { - $i = array(); - $i['id'] = $id++; - $i['name'] = $r['id']; - $i['date'] = \OCP\Util::formatDate($r['timestamp']); - $i['timestamp'] = $r['timestamp']; - $i['etag'] = $r['timestamp']; // add fake etag, it is only needed to identify the preview image - $i['mimetype'] = $r['mime']; - $i['type'] = $r['type']; - if ($i['type'] === 'file') { - $fileinfo = pathinfo($r['id']); - $i['basename'] = $fileinfo['filename']; - $i['extension'] = isset($fileinfo['extension']) ? ('.'.$fileinfo['extension']) : ''; - } - $i['directory'] = $r['location']; - if ($i['directory'] === '/') { - $i['directory'] = ''; - } - $i['permissions'] = \OCP\PERMISSION_READ; - if (\OCP\App::isEnabled('files_encryption')) { - $i['isPreviewAvailable'] = false; - } else { - $i['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($r['mime']); - } - $i['icon'] = \OCA\Files\Helper::determineIcon($i); - $files[] = new FileInfo($absoluteDir . '/' . $i['name'], $storage, $internalPath . '/' . $i['name'], $i); - } - - usort($files, array('\OCA\Files\Helper', 'fileCmp')); + usort($result, array('\OCA\Files\Helper', 'fileCmp')); - return $files; + return $result; } /** - * Splits the given path into a breadcrumb structure. - * @param string $dir path to process - * @return array where each entry is a hash of the absolute - * directory path and its name + * Format file infos for JSON + * @param \OCP\Files\FileInfo[] $fileInfos file infos */ - public static function makeBreadcrumb($dir){ - // Make breadcrumb - $pathtohere = ''; - $breadcrumb = array(); - foreach (explode('/', $dir) as $i) { - if ($i !== '') { - if ( preg_match('/^(.+)\.d[0-9]+$/', $i, $match) ) { - $name = $match[1]; - } else { - $name = $i; - } - $pathtohere .= '/' . $i; - $breadcrumb[] = array('dir' => $pathtohere, 'name' => $name); + public static function formatFileInfos($fileInfos) { + $files = array(); + $id = 0; + foreach ($fileInfos as $i) { + $entry = \OCA\Files\Helper::formatFileInfo($i); + $entry['id'] = $id++; + $entry['etag'] = $entry['mtime']; // add fake etag, it is only needed to identify the preview image + $entry['permissions'] = \OCP\PERMISSION_READ; + if (\OCP\App::isEnabled('files_encryption')) { + $entry['isPreviewAvailable'] = false; } + $files[] = $entry; } - return $breadcrumb; + return $files; } } diff --git a/apps/files_trashbin/templates/index.php b/apps/files_trashbin/templates/index.php index f9264d4352c..615cf8bdd00 100644 --- a/apps/files_trashbin/templates/index.php +++ b/apps/files_trashbin/templates/index.php @@ -1,13 +1,11 @@ <div id="controls"> - <?php print_unescaped($_['breadcrumb']); ?> - <div id="file_action_panel"></div> + <div id="file_action_panel"></div> </div> <div id='notification'></div> -<div id="emptycontent" <?php if (!(isset($_['files']) && count($_['files']) === 0 && $_['dirlisting'] === false && !$_['ajaxLoad'])):?>class="hidden"<?php endif; ?>><?php p($l->t('Nothing in here. Your trash bin is empty!'))?></div> +<div id="emptycontent" class="hidden"><?php p($l->t('Nothing in here. Your trash bin is empty!'))?></div> -<input type="hidden" name="ajaxLoad" id="ajaxLoad" value="<?php p($_['ajaxLoad']); ?>" /> -<input type="hidden" id="disableSharing" data-status="<?php p($_['disableSharing']); ?>"></input> +<input type="hidden" id="permissions" value="0"></input> <input type="hidden" name="dir" value="<?php p($_['dir']) ?>" id="dir"> <table id="filestable"> @@ -40,6 +38,5 @@ </tr> </thead> <tbody id="fileList"> - <?php print_unescaped($_['fileList']); ?> </tbody> </table> diff --git a/apps/files_trashbin/templates/part.breadcrumb.php b/apps/files_trashbin/templates/part.breadcrumb.php deleted file mode 100644 index fdf78c190d0..00000000000 --- a/apps/files_trashbin/templates/part.breadcrumb.php +++ /dev/null @@ -1,19 +0,0 @@ -<div class="crumb home"> - <a href="<?php print_unescaped($_['home']); ?>"> - <img src="<?php print_unescaped(OCP\image_path('core', 'places/home.svg'));?>" class="svg" /> - </a> -</div> -<div class="crumb svg" - data-dir='/'> - <a href="<?php p($_['baseURL']); ?>"><?php p($l->t("Deleted Files")); ?></a> -</div> -<?php if(count($_["breadcrumb"])):?> -<?php endif;?> -<?php for($i=0; $i<count($_["breadcrumb"]); $i++): - $crumb = $_["breadcrumb"][$i]; - $dir = \OCP\Util::encodePath($crumb["dir"]); ?> - <div class="crumb <?php if($i === count($_["breadcrumb"])-1) p('last');?> svg" - data-dir='<?php p($dir);?>'> - <a href="<?php p($_['baseURL'].$dir); ?>"><?php p($crumb["name"]); ?></a> - </div> -<?php endfor; diff --git a/apps/files_trashbin/templates/part.list.php b/apps/files_trashbin/templates/part.list.php deleted file mode 100644 index c32d9fd54da..00000000000 --- a/apps/files_trashbin/templates/part.list.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php foreach($_['files'] as $file): - $relative_deleted_date = OCP\relative_modified_date($file['timestamp']); - // the older the file, the brighter the shade of grey; days*14 - $relative_date_color = round((time()-$file['date'])/60/60/24*14); - if($relative_date_color>200) $relative_date_color = 200; - $name = \OCP\Util::encodePath($file['name']); - $directory = \OCP\Util::encodePath($file['directory']); ?> - <tr data-filename="<?php p($file['name']);?>" - data-type="<?php ($file['type'] === 'dir')?p('dir'):p('file')?>" - data-mime="<?php p($file['mimetype'])?>" - data-permissions='<?php p($file['permissions']); ?>' - <?php if ( $_['dirlisting'] ): ?> - id="<?php p($file['directory'].'/'.$file['name']);?>" - data-file="<?php p($name);?>" - data-timestamp='' - data-dirlisting=1 - <?php else: ?> - id="<?php p($file['name'].'.d'.$file['timestamp']);?>" - data-file="<?php p($file['name'].'.d'.$file['timestamp']);?>" - data-timestamp='<?php p($file['timestamp']);?>' - data-dirlisting=0 - <?php endif; ?>> - <?php if($file['isPreviewAvailable']): ?> - <td class="filename svg preview-icon" - <?php else: ?> - <td class="filename svg" - <?php endif; ?> - <?php if($file['type'] === 'dir'): ?> - style="background-image:url(<?php print_unescaped(OCP\mimetype_icon('dir')); ?>)" - <?php else: ?> - <?php if($file['isPreviewAvailable']): ?> - style="background-image:url(<?php print_unescaped(OCA\Files_Trashbin\Trashbin::preview_icon(!$_['dirlisting'] ? ($file['name'].'.d'.$file['timestamp']) : ($file['directory'].'/'.$file['name']))); ?>)" - <?php else: ?> - style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)" - <?php endif; ?> - <?php endif; ?> - > - <?php if(!isset($_['readonly']) || !$_['readonly']): ?> - <input id="select-<?php p($file['id']); ?>" type="checkbox" /> - <label for="select-<?php p($file['id']); ?>"></label> - <?php endif; ?> - <?php if($file['type'] === 'dir'): ?> - <?php if( $_['dirlisting'] ): ?> - <a class="name dir" href="<?php p($_['baseURL'].'/'.$name); ?>" title=""> - <?php else: ?> - <a class="name dir" href="<?php p($_['baseURL'].'/'.$name.'.d'.$file['timestamp']); ?>" title=""> - <?php endif; ?> - <?php else: ?> - <?php if( $_['dirlisting'] ): ?> - <a class="name file" href="<?php p($_['downloadURL'].'/'.$name); ?>" title=""> - <?php else: ?> - <a class="name file" href="<?php p($_['downloadURL'].'/'.$name.'.d'.$file['timestamp']);?>" title=""> - <?php endif; ?> - <?php endif; ?> - <span class="nametext"> - <?php if($file['type'] === 'dir'):?> - <?php print_unescaped(htmlspecialchars($file['name']));?> - <?php else:?> - <?php print_unescaped(htmlspecialchars($file['basename']));?><span - class='extension'><?php p($file['extension']);?></span> - <?php endif;?> - </span> - <?php if($file['type'] === 'dir'):?> - <span class="uploadtext" currentUploads="0"> - </span> - <?php endif;?> - </a> - </td> - <td class="date"> - <span class="modified" - title="<?php p($file['date']); ?>" - style="color:rgb(<?php p($relative_date_color.',' - .$relative_date_color.',' - .$relative_date_color) ?>)"> - <?php p($relative_deleted_date); ?> - </span> - </td> - </tr> -<?php endforeach; |