summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2013-09-16 10:42:37 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2013-09-16 10:42:37 +0200
commit82cbbb8ab8cfe81559c45905d7fca819d71df346 (patch)
tree947d58076dae8d5c4d0bd001ccebbe079448e057 /apps/files
parent1558cb860c2fb26fdde14fce2a16acbb29d12b3e (diff)
parent46f59b165e5bd1908509e8a62b67bf983cfd6224 (diff)
downloadnextcloud-server-82cbbb8ab8cfe81559c45905d7fca819d71df346.tar.gz
nextcloud-server-82cbbb8ab8cfe81559c45905d7fca819d71df346.zip
Merge branch 'master' into encryption_improved_error_messages_4617
Conflicts: apps/files/index.php
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/ajax/list.php43
-rw-r--r--apps/files/ajax/rawlist.php54
-rw-r--r--apps/files/css/files.css35
-rw-r--r--apps/files/index.php77
-rw-r--r--apps/files/js/file-upload.js24
-rw-r--r--apps/files/js/fileactions.js5
-rw-r--r--apps/files/js/filelist.js203
-rw-r--r--apps/files/js/files.js184
-rw-r--r--apps/files/l10n/ca.php1
-rw-r--r--apps/files/l10n/es.php8
-rw-r--r--apps/files/l10n/es_AR.php7
-rw-r--r--apps/files/l10n/et_EE.php1
-rw-r--r--apps/files/l10n/fr.php12
-rw-r--r--apps/files/l10n/gl.php1
-rw-r--r--apps/files/l10n/ku_IQ.php1
-rw-r--r--apps/files/l10n/lt_LT.php11
-rw-r--r--apps/files/l10n/nl.php1
-rw-r--r--apps/files/l10n/nn_NO.php11
-rw-r--r--apps/files/l10n/pl.php8
-rw-r--r--apps/files/l10n/pt_BR.php8
-rw-r--r--apps/files/l10n/ro.php37
-rw-r--r--apps/files/l10n/sq.php13
-rw-r--r--apps/files/l10n/uk.php1
-rw-r--r--apps/files/lib/helper.php116
-rw-r--r--apps/files/templates/index.php39
-rw-r--r--apps/files/templates/part.list.php27
26 files changed, 653 insertions, 275 deletions
diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php
index c50e96b2429..f1b713b5534 100644
--- a/apps/files/ajax/list.php
+++ b/apps/files/ajax/list.php
@@ -10,35 +10,38 @@ OCP\JSON::checkLoggedIn();
// Load the files
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
+
+if (!\OC\Files\Filesystem::is_dir($dir . '/')) {
+ header("HTTP/1.0 404 Not Found");
+ exit();
+}
+
$doBreadcrumb = isset($_GET['breadcrumb']);
$data = array();
+$baseUrl = OCP\Util::linkTo('files', 'index.php') . '?dir=';
+
+$permissions = \OCA\files\lib\Helper::getDirPermissions($dir);
// Make breadcrumb
if($doBreadcrumb) {
- $breadcrumb = array();
- $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", $breadcrumb, false );
+ $breadcrumb = \OCA\files\lib\Helper::makeBreadcrumb($dir);
+
+ $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
+ $breadcrumbNav->assign('breadcrumb', $breadcrumb, false);
+ $breadcrumbNav->assign('baseURL', $baseUrl);
$data['breadcrumb'] = $breadcrumbNav->fetchPage();
}
// make filelist
-$files = array();
-foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $i ) {
- $i["date"] = OCP\Util::formatDate($i["mtime"] );
- $files[] = $i;
-}
-
-$list = new OCP\Template( "files", "part.list", "" );
-$list->assign( "files", $files, false );
-$data = array('files' => $list->fetchPage());
+$files = \OCA\files\lib\Helper::getFiles($dir);
+
+$list = new OCP\Template("files", "part.list", "");
+$list->assign('files', $files, false);
+$list->assign('baseURL', $baseUrl, false);
+$list->assign('downloadURL', OCP\Util::linkToRoute('download', array('file' => '/')));
+$list->assign('isPublic', false);
+$data['files'] = $list->fetchPage();
+$data['permissions'] = $permissions;
OCP\JSON::success(array('data' => $data));
diff --git a/apps/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php
index f568afad4da..9ccd4cc299a 100644
--- a/apps/files/ajax/rawlist.php
+++ b/apps/files/ajax/rawlist.php
@@ -11,22 +11,54 @@ OCP\JSON::checkLoggedIn();
// Load the files
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
-$mimetype = isset($_GET['mimetype']) ? $_GET['mimetype'] : '';
+$mimetypes = isset($_GET['mimetypes']) ? json_decode($_GET['mimetypes'], true) : '';
+
+// Clean up duplicates from array and deal with non-array requests
+if (is_array($mimetypes)) {
+ $mimetypes = array_unique($mimetypes);
+} elseif (is_null($mimetypes)) {
+ $mimetypes = array($_GET['mimetypes']);
+}
// make filelist
$files = array();
// If a type other than directory is requested first load them.
-if($mimetype && strpos($mimetype, 'httpd/unix-directory') === false) {
- foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, 'httpd/unix-directory' ) as $i ) {
- $i["date"] = OCP\Util::formatDate($i["mtime"] );
- $i['mimetype_icon'] = $i['type'] == 'dir' ? \mimetype_icon('dir'): \mimetype_icon($i['mimetype']);
- $files[] = $i;
+if($mimetypes && !in_array('httpd/unix-directory', $mimetypes)) {
+ foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, 'httpd/unix-directory' ) as $file ) {
+ $file['directory'] = $dir;
+ $file['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($file['mimetype']);
+ $file["date"] = OCP\Util::formatDate($file["mtime"]);
+ $file['mimetype_icon'] = \OCA\files\lib\Helper::determineIcon($file);
+ $files[] = $file;
}
}
-foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, $mimetype ) as $i ) {
- $i["date"] = OCP\Util::formatDate($i["mtime"] );
- $i['mimetype_icon'] = $i['type'] == 'dir' ? \mimetype_icon('dir'): \mimetype_icon($i['mimetype']);
- $files[] = $i;
+
+if (is_array($mimetypes) && count($mimetypes)) {
+ foreach ($mimetypes as $mimetype) {
+ foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, $mimetype ) as $file ) {
+ $file['directory'] = $dir;
+ $file['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($file['mimetype']);
+ $file["date"] = OCP\Util::formatDate($file["mtime"]);
+ $file['mimetype_icon'] = \OCA\files\lib\Helper::determineIcon($file);
+ $files[] = $file;
+ }
+ }
+} else {
+ foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $file ) {
+ $file['directory'] = $dir;
+ $file['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($file['mimetype']);
+ $file["date"] = OCP\Util::formatDate($file["mtime"]);
+ $file['mimetype_icon'] = \OCA\files\lib\Helper::determineIcon($file);
+ $files[] = $file;
+ }
}
-OCP\JSON::success(array('data' => $files));
+// Sort by name
+usort($files, function ($a, $b) {
+ if ($a['name'] === $b['name']) {
+ return 0;
+ }
+ return ($a['name'] < $b['name']) ? -1 : 1;
+});
+
+OC_JSON::success(array('data' => $files));
diff --git a/apps/files/css/files.css b/apps/files/css/files.css
index 02a73ba83e5..41d9808c56b 100644
--- a/apps/files/css/files.css
+++ b/apps/files/css/files.css
@@ -69,11 +69,11 @@
/* FILE TABLE */
#filestable { position: relative; top:37px; width:100%; }
-tbody tr { background-color:#fff; height:2.5em; }
-tbody tr:hover, tbody tr:active {
+#filestable tbody tr { background-color:#fff; height:2.5em; }
+#filestable tbody tr:hover, tbody tr:active {
background-color: rgb(240,240,240);
}
-tbody tr.selected {
+#filestable tbody tr.selected {
background-color: rgb(230,230,230);
}
tbody a { color:#000; }
@@ -190,10 +190,15 @@ table td.filename form { font-size:.85em; margin-left:3em; margin-right:3em; }
#fileList tr:hover td.filename>input[type="checkbox"]:first-child,
#fileList tr td.filename>input[type="checkbox"]:checked:first-child,
#fileList tr.selected td.filename>input[type="checkbox"]:first-child {
+ opacity: 1;
+}
+.lte9 #fileList tr:hover td.filename>input[type="checkbox"]:first-child,
+.lte9 #fileList tr td.filename>input[type="checkbox"][checked=checked]:first-child,
+.lte9 #fileList tr.selected td.filename>input[type="checkbox"]:first-child {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=100);
- opacity: 1;
}
+
/* Use label to have bigger clickable size for checkbox */
#fileList tr td.filename>input[type="checkbox"] + label,
#select_all + label {
@@ -331,3 +336,25 @@ table.dragshadow td.size {
text-align: center;
margin-left: -200px;
}
+.mask {
+ z-index: 50;
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background-color: white;
+ background-repeat: no-repeat no-repeat;
+ background-position: 50%;
+ opacity: 0.7;
+ filter: alpha(opacity=70);
+ transition: opacity 100ms;
+ -moz-transition: opacity 100ms;
+ -o-transition: opacity 100ms;
+ -ms-transition: opacity 100ms;
+ -webkit-transition: opacity 100ms;
+}
+.mask.transparent{
+ opacity: 0;
+}
+
diff --git a/apps/files/index.php b/apps/files/index.php
index b81ba2bdde9..5ef69a5d35e 100644
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -41,79 +41,58 @@ if (!\OC\Files\Filesystem::is_dir($dir . '/')) {
exit();
}
-function fileCmp($a, $b) {
- if ($a['type'] == 'dir' and $b['type'] != 'dir') {
- return -1;
- } elseif ($a['type'] != 'dir' and $b['type'] == 'dir') {
- return 1;
- } else {
- return strnatcasecmp($a['name'], $b['name']);
+$isIE8 = false;
+preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
+if (count($matches) > 0 && $matches[1] <= 8){
+ $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 = '/';
}
+ header('Location: ' . OCP\Util::linkTo('files', 'index.php') . '#?dir=' . \OCP\Util::encodePath($dir));
+ exit();
}
+$ajaxLoad = false;
$files = array();
$user = OC_User::getUser();
if (\OC\Files\Cache\Upgrade::needUpgrade($user)) { //dont load anything if we need to upgrade the cache
- $content = array();
$needUpgrade = true;
$freeSpace = 0;
} else {
- $content = \OC\Files\Filesystem::getDirectoryContent($dir);
+ if ($isIE8){
+ // after the redirect above, the URL will have a format
+ // like "files#?dir=path" which means that no path was given
+ // (dir is not set). In that specific case, we don't return any
+ // files because the client will take care of switching the dir
+ // to the one from the hash, then ajax-load the initial file list
+ $files = array();
+ $ajaxLoad = true;
+ }
+ else{
+ $files = \OCA\files\lib\Helper::getFiles($dir);
+ }
$freeSpace = \OC\Files\Filesystem::free_space($dir);
$needUpgrade = false;
}
-foreach ($content as $i) {
- $i['date'] = OCP\Util::formatDate($i['mtime']);
- if ($i['type'] == 'file') {
- $fileinfo = pathinfo($i['name']);
- $i['basename'] = $fileinfo['filename'];
- if (!empty($fileinfo['extension'])) {
- $i['extension'] = '.' . $fileinfo['extension'];
- } else {
- $i['extension'] = '';
- }
- }
- $i['directory'] = $dir;
- $i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($i['mimetype']);
- $files[] = $i;
-}
-
-usort($files, "fileCmp");
// Make breadcrumb
-$breadcrumb = array();
-$pathtohere = '';
-foreach (explode('/', $dir) as $i) {
- if ($i != '') {
- $pathtohere .= '/' . $i;
- $breadcrumb[] = array('dir' => $pathtohere, 'name' => $i);
- }
-}
+$breadcrumb = \OCA\files\lib\Helper::makeBreadcrumb($dir);
// make breadcrumb und filelist markup
$list = new OCP\Template('files', 'part.list', '');
$list->assign('files', $files);
$list->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir=');
$list->assign('downloadURL', OCP\Util::linkToRoute('download', array('file' => '/')));
-$list->assign('disableSharing', false);
$list->assign('isPublic', false);
$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
$breadcrumbNav->assign('breadcrumb', $breadcrumb);
$breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir=');
-$permissions = OCP\PERMISSION_READ;
-if (\OC\Files\Filesystem::isCreatable($dir . '/')) {
- $permissions |= OCP\PERMISSION_CREATE;
-}
-if (\OC\Files\Filesystem::isUpdatable($dir . '/')) {
- $permissions |= OCP\PERMISSION_UPDATE;
-}
-if (\OC\Files\Filesystem::isDeletable($dir . '/')) {
- $permissions |= OCP\PERMISSION_DELETE;
-}
-if (\OC\Files\Filesystem::isSharable($dir . '/')) {
- $permissions |= OCP\PERMISSION_SHARE;
-}
+$permissions = \OCA\files\lib\Helper::getDirPermissions($dir);
if ($needUpgrade) {
OCP\Util::addscript('files', 'upgrade');
@@ -158,5 +137,7 @@ if ($needUpgrade) {
$tmpl->assign('publicUploadEnabled', $publicUploadEnabled);
$tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles());
$tmpl->assign("encryptionInitStatus", $encryptionInitStatus);
+ $tmpl->assign('disableSharing', false);
+ $tmpl->assign('ajaxLoad', $ajaxLoad);
$tmpl->printPage();
}
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index 3d620c5640b..aeb2da90d5f 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -46,6 +46,15 @@ $(document).ready(function() {
$('#uploadprogresswrapper input.stop').show();
}
},
+ submit: function(e, data) {
+ if ( ! data.formData ) {
+ // noone set update parameters, we set the minimum
+ data.formData = {
+ requesttoken: oc_requesttoken,
+ dir: $('#dir').val()
+ };
+ }
+ },
/**
* called after the first add, does NOT have the data param
* @param e
@@ -141,15 +150,8 @@ $(document).ready(function() {
$('#uploadprogressbar').fadeOut();
}
};
- var file_upload_handler = function() {
- $('#file_upload_start').fileupload(file_upload_param);
- };
-
-
-
- if ( document.getElementById('data-upload-form') ) {
- $(file_upload_handler);
- }
+ $('#file_upload_start').fileupload(file_upload_param);
+
$.assocArraySize = function(obj) {
// http://stackoverflow.com/a/6700/11236
var size = 0, key;
@@ -344,8 +346,12 @@ $(document).ready(function() {
}
var li=form.parent();
form.remove();
+ /* workaround for IE 9&10 click event trap, 2 lines: */
+ $('input').first().focus();
+ $('#content').focus();
li.append('<p>'+li.data('text')+'</p>');
$('#new>a').click();
});
});
+ window.file_upload_param = file_upload_param;
});
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 097fe521aa6..330fe86f6b3 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -196,13 +196,12 @@ FileActions.register('all', 'Rename', OC.PERMISSION_UPDATE, function () {
FileList.rename(filename);
});
-
FileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename) {
- var dir = $('#dir').val();
+ var dir = $('#dir').val() || '/';
if (dir !== '/') {
dir = dir + '/';
}
- window.location = OC.linkTo('files', 'index.php') + '?dir=' + encodeURIComponent(dir + filename);
+ FileList.changeDirectory(dir + filename);
});
FileActions.setDefault('dir', 'Open');
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 29be5e0d362..b50d46c98d3 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -1,7 +1,28 @@
var FileList={
useUndo:true,
+ postProcessList: function(){
+ $('#fileList tr').each(function(){
+ //little hack to set unescape filenames in attribute
+ $(this).attr('data-file',decodeURIComponent($(this).attr('data-file')));
+ });
+ },
update:function(fileListHtml) {
- $('#fileList').empty().html(fileListHtml);
+ var $fileList = $('#fileList'),
+ permissions = $('#permissions').val(),
+ isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0;
+ $fileList.empty().html(fileListHtml);
+ $('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').length > 0);
+ $fileList.find('tr').each(function () {
+ FileActions.display($(this).children('td.filename'));
+ });
+ $fileList.trigger(jQuery.Event("fileActionsReady"));
+ FileList.postProcessList();
+ // "Files" might not be loaded in extending apps
+ if (window.Files){
+ Files.setupDragAndDrop();
+ }
+ FileList.updateFileSummary();
+ $fileList.trigger(jQuery.Event("updated"));
},
createRow:function(type, name, iconurl, linktarget, size, lastModified, permissions){
var td, simpleSize, basename, extension;
@@ -134,20 +155,109 @@ var FileList={
FileActions.display(tr.find('td.filename'));
return tr;
},
- refresh:function(data) {
- var result = jQuery.parseJSON(data.responseText);
+ /**
+ * @brief Changes the current directory and reload the file list.
+ * @param targetDir target directory (non URL encoded)
+ * @param changeUrl false if the URL must not be changed (defaults to true)
+ */
+ changeDirectory: function(targetDir, changeUrl, force){
+ var $dir = $('#dir'),
+ url,
+ currentDir = $dir.val() || '/';
+ targetDir = targetDir || '/';
+ if (!force && currentDir === targetDir){
+ return;
+ }
+ FileList.setCurrentDir(targetDir, changeUrl);
+ FileList.reload();
+ },
+ linkTo: function(dir){
+ return OC.linkTo('files', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
+ },
+ setCurrentDir: function(targetDir, changeUrl){
+ $('#dir').val(targetDir);
+ if (changeUrl !== false){
+ if (window.history.pushState && changeUrl !== false){
+ url = FileList.linkTo(targetDir);
+ window.history.pushState({dir: targetDir}, '', url);
+ }
+ // use URL hash for IE8
+ else{
+ window.location.hash = '?dir='+ encodeURIComponent(targetDir).replace(/%2F/g, '/');
+ }
+ }
+ },
+ /**
+ * @brief Reloads the file list using ajax call
+ */
+ reload: function(){
+ FileList.showMask();
+ if (FileList._reloadCall){
+ FileList._reloadCall.abort();
+ }
+ FileList._reloadCall = $.ajax({
+ url: OC.filePath('files','ajax','list.php'),
+ data: {
+ dir : $('#dir').val(),
+ breadcrumb: true
+ },
+ error: function(result){
+ FileList.reloadCallback(result);
+ },
+ success: function(result) {
+ FileList.reloadCallback(result);
+ }
+ });
+ },
+ reloadCallback: function(result){
+ var $controls = $('#controls');
+
+ delete FileList._reloadCall;
+ FileList.hideMask();
+
+ if (!result || result.status === 'error') {
+ OC.Notification.show(result.data.message);
+ return;
+ }
+
+ if (result.status === 404){
+ // go back home
+ FileList.changeDirectory('/');
+ return;
+ }
+
+ if (result.data.permissions){
+ FileList.setDirectoryPermissions(result.data.permissions);
+ }
+
if(typeof(result.data.breadcrumb) != 'undefined'){
- updateBreadcrumb(result.data.breadcrumb);
+ $controls.find('.crumb').remove();
+ $controls.prepend(result.data.breadcrumb);
+
+ var width = $(window).width();
+ Files.initBreadCrumbs();
+ Files.resizeBreadcrumbs(width, true);
+
+ // in case svg is not supported by the browser we need to execute the fallback mechanism
+ if(!SVGSupport()) {
+ replaceSVG();
+ }
}
+
FileList.update(result.data.files);
- resetFileActionPanel();
+ },
+ setDirectoryPermissions: function(permissions){
+ var isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0;
+ $('#permissions').val(permissions);
+ $('.creatable').toggleClass('hidden', !isCreatable);
+ $('.notCreatable').toggleClass('hidden', isCreatable);
},
remove:function(name){
$('tr').filterAttr('data-file',name).find('td.filename').draggable('destroy');
$('tr').filterAttr('data-file',name).remove();
FileList.updateFileSummary();
if($('tr[data-file]').length==0){
- $('#emptycontent').show();
+ $('#emptycontent').removeClass('hidden');
}
},
insertElement:function(name,type,element){
@@ -177,7 +287,7 @@ var FileList={
}else{
$('#fileList').append(element);
}
- $('#emptycontent').hide();
+ $('#emptycontent').addClass('hidden');
FileList.updateFileSummary();
},
loadingDone:function(name, id){
@@ -508,6 +618,31 @@ var FileList={
$connector.show();
}
}
+ },
+ showMask: function(){
+ // in case one was shown before
+ var $mask = $('#content .mask');
+ if ($mask.length){
+ return;
+ }
+
+ $mask = $('<div class="mask transparent"></div>');
+
+ $mask.css('background-image', 'url('+ OC.imagePath('core', 'loading.gif') + ')');
+ $mask.css('background-repeat', 'no-repeat');
+ $('#content').append($mask);
+
+ // block UI, but only make visible in case loading takes longer
+ FileList._maskTimeout = window.setTimeout(function(){
+ // reset opacity
+ $mask.removeClass('transparent');
+ }, 250);
+ },
+ hideMask: function(){
+ var $mask = $('#content .mask').remove();
+ if (FileList._maskTimeout){
+ window.clearTimeout(FileList._maskTimeout);
+ }
}
};
@@ -629,8 +764,8 @@ $(document).ready(function(){
}
// update folder size
- var size = parseInt(data.context.data('size'));
- size += parseInt(file.size) ;
+ var size = parseInt(data.context.data('size'));
+ size += parseInt(file.size);
data.context.attr('data-size', size);
data.context.find('td.filesize').text(humanFileSize(size));
@@ -710,5 +845,55 @@ $(document).ready(function(){
$(window).trigger('beforeunload');
});
+ function parseHashQuery(){
+ var hash = window.location.hash,
+ pos = hash.indexOf('?'),
+ query;
+ if (pos >= 0){
+ return hash.substr(pos + 1);
+ }
+ return '';
+ }
+
+ function parseCurrentDirFromUrl(){
+ var query = parseHashQuery(),
+ params,
+ dir = '/';
+ // try and parse from URL hash first
+ if (query){
+ params = OC.parseQueryString(query);
+ }
+ // else read from query attributes
+ if (!params){
+ params = OC.parseQueryString(location.search);
+ }
+ return (params && params.dir) || '/';
+ }
+
+ // fallback to hashchange when no history support
+ if (!window.history.pushState){
+ $(window).on('hashchange', function(){
+ FileList.changeDirectory(parseCurrentDirFromUrl(), false);
+ });
+ }
+ window.onpopstate = function(e){
+ var targetDir;
+ if (e.state && e.state.dir){
+ targetDir = e.state.dir;
+ }
+ else{
+ // read from URL
+ targetDir = parseCurrentDirFromUrl();
+ }
+ if (targetDir){
+ FileList.changeDirectory(targetDir, false);
+ }
+ }
+
+ if (parseInt($('#ajaxLoad').val(), 10) === 1){
+ // need to initially switch the dir to the one from the hash (IE8)
+ FileList.changeDirectory(parseCurrentDirFromUrl(), false, true);
+ }
+
FileList.createFileSummary();
});
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 63c3544b53d..01a82308a8b 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -103,29 +103,106 @@ Files={
OC.Notification.show(t('files_encryption', 'Encryption was disabled but your files are still encrypted. Please go to your personal settings to decrypt your files.'));
return;
}
+ },
+
+ setupDragAndDrop: function(){
+ var $fileList = $('#fileList');
+
+ //drag/drop of files
+ $fileList.find('tr td.filename').each(function(i,e){
+ if ($(e).parent().data('permissions') & OC.PERMISSION_DELETE) {
+ $(e).draggable(dragOptions);
+ }
+ });
+
+ $fileList.find('tr[data-type="dir"] td.filename').each(function(i,e){
+ if ($(e).parent().data('permissions') & OC.PERMISSION_CREATE){
+ $(e).droppable(folderDropOptions);
+ }
+ });
+ },
+
+ lastWidth: 0,
+
+ initBreadCrumbs: function () {
+ Files.lastWidth = 0;
+ Files.breadcrumbs = [];
+
+ // initialize with some extra space
+ Files.breadcrumbsWidth = 64;
+ if ( document.getElementById("navigation") ) {
+ Files.breadcrumbsWidth += $('#navigation').get(0).offsetWidth;
+ }
+ Files.hiddenBreadcrumbs = 0;
+
+ $.each($('.crumb'), function(index, breadcrumb) {
+ Files.breadcrumbs[index] = breadcrumb;
+ Files.breadcrumbsWidth += $(breadcrumb).get(0).offsetWidth;
+ });
+
+ $.each($('#controls .actions>div'), function(index, action) {
+ Files.breadcrumbsWidth += $(action).get(0).offsetWidth;
+ });
+
+ // event handlers for breadcrumb items
+ $('#controls .crumb a').on('click', onClickBreadcrumb);
+ },
+
+ resizeBreadcrumbs: function (width, firstRun) {
+ if (width != Files.lastWidth) {
+ if ((width < Files.lastWidth || firstRun) && width < Files.breadcrumbsWidth) {
+ if (Files.hiddenBreadcrumbs == 0) {
+ Files.breadcrumbsWidth -= $(Files.breadcrumbs[1]).get(0).offsetWidth;
+ $(Files.breadcrumbs[1]).find('a').hide();
+ $(Files.breadcrumbs[1]).append('<span>...</span>');
+ Files.breadcrumbsWidth += $(Files.breadcrumbs[1]).get(0).offsetWidth;
+ Files.hiddenBreadcrumbs = 2;
+ }
+ var i = Files.hiddenBreadcrumbs;
+ while (width < Files.breadcrumbsWidth && i > 1 && i < Files.breadcrumbs.length - 1) {
+ Files.breadcrumbsWidth -= $(Files.breadcrumbs[i]).get(0).offsetWidth;
+ $(Files.breadcrumbs[i]).hide();
+ Files.hiddenBreadcrumbs = i;
+ i++
+ }
+ } else if (width > Files.lastWidth && Files.hiddenBreadcrumbs > 0) {
+ var i = Files.hiddenBreadcrumbs;
+ while (width > Files.breadcrumbsWidth && i > 0) {
+ if (Files.hiddenBreadcrumbs == 1) {
+ Files.breadcrumbsWidth -= $(Files.breadcrumbs[1]).get(0).offsetWidth;
+ $(Files.breadcrumbs[1]).find('span').remove();
+ $(Files.breadcrumbs[1]).find('a').show();
+ Files.breadcrumbsWidth += $(Files.breadcrumbs[1]).get(0).offsetWidth;
+ } else {
+ $(Files.breadcrumbs[i]).show();
+ Files.breadcrumbsWidth += $(Files.breadcrumbs[i]).get(0).offsetWidth;
+ if (Files.breadcrumbsWidth > width) {
+ Files.breadcrumbsWidth -= $(Files.breadcrumbs[i]).get(0).offsetWidth;
+ $(Files.breadcrumbs[i]).hide();
+ break;
+ }
+ }
+ i--;
+ Files.hiddenBreadcrumbs = i;
+ }
+ }
+ Files.lastWidth = width;
+ }
}
};
$(document).ready(function() {
+ // FIXME: workaround for trashbin app
+ if (window.trashBinApp){
+ return;
+ }
Files.displayEncryptionWarning();
Files.bindKeyboardShortcuts(document, jQuery);
- $('#fileList tr').each(function(){
- //little hack to set unescape filenames in attribute
- $(this).attr('data-file',decodeURIComponent($(this).attr('data-file')));
- });
+
+ FileList.postProcessList();
+ Files.setupDragAndDrop();
$('#file_action_panel').attr('activeAction', false);
- //drag/drop of files
- $('#fileList tr td.filename').each(function(i,e){
- if ($(e).parent().data('permissions') & OC.PERMISSION_DELETE) {
- $(e).draggable(dragOptions);
- }
- });
- $('#fileList tr[data-type="dir"] td.filename').each(function(i,e){
- if ($(e).parent().data('permissions') & OC.PERMISSION_CREATE){
- $(e).droppable(folderDropOptions);
- }
- });
$('div.crumb:not(.last)').droppable(crumbDropOptions);
$('ul#apps>li:first-child').data('dir','');
if($('div.crumb').length){
@@ -277,72 +354,15 @@ $(document).ready(function() {
//do a background scan if needed
scanFiles();
- var lastWidth = 0;
- var breadcrumbs = [];
- var breadcrumbsWidth = 0;
- if ( document.getElementById("navigation") ) {
- breadcrumbsWidth = $('#navigation').get(0).offsetWidth;
- }
- var hiddenBreadcrumbs = 0;
-
- $.each($('.crumb'), function(index, breadcrumb) {
- breadcrumbs[index] = breadcrumb;
- breadcrumbsWidth += $(breadcrumb).get(0).offsetWidth;
- });
-
-
- $.each($('#controls .actions>div'), function(index, action) {
- breadcrumbsWidth += $(action).get(0).offsetWidth;
- });
-
- function resizeBreadcrumbs(firstRun) {
- var width = $(this).width();
- if (width != lastWidth) {
- if ((width < lastWidth || firstRun) && width < breadcrumbsWidth) {
- if (hiddenBreadcrumbs == 0) {
- breadcrumbsWidth -= $(breadcrumbs[1]).get(0).offsetWidth;
- $(breadcrumbs[1]).find('a').hide();
- $(breadcrumbs[1]).append('<span>...</span>');
- breadcrumbsWidth += $(breadcrumbs[1]).get(0).offsetWidth;
- hiddenBreadcrumbs = 2;
- }
- var i = hiddenBreadcrumbs;
- while (width < breadcrumbsWidth && i > 1 && i < breadcrumbs.length - 1) {
- breadcrumbsWidth -= $(breadcrumbs[i]).get(0).offsetWidth;
- $(breadcrumbs[i]).hide();
- hiddenBreadcrumbs = i;
- i++
- }
- } else if (width > lastWidth && hiddenBreadcrumbs > 0) {
- var i = hiddenBreadcrumbs;
- while (width > breadcrumbsWidth && i > 0) {
- if (hiddenBreadcrumbs == 1) {
- breadcrumbsWidth -= $(breadcrumbs[1]).get(0).offsetWidth;
- $(breadcrumbs[1]).find('span').remove();
- $(breadcrumbs[1]).find('a').show();
- breadcrumbsWidth += $(breadcrumbs[1]).get(0).offsetWidth;
- } else {
- $(breadcrumbs[i]).show();
- breadcrumbsWidth += $(breadcrumbs[i]).get(0).offsetWidth;
- if (breadcrumbsWidth > width) {
- breadcrumbsWidth -= $(breadcrumbs[i]).get(0).offsetWidth;
- $(breadcrumbs[i]).hide();
- break;
- }
- }
- i--;
- hiddenBreadcrumbs = i;
- }
- }
- lastWidth = width;
- }
- }
+ Files.initBreadCrumbs();
$(window).resize(function() {
- resizeBreadcrumbs(false);
+ var width = $(this).width();
+ Files.resizeBreadcrumbs(width, false);
});
- resizeBreadcrumbs(true);
+ var width = $(this).width();
+ Files.resizeBreadcrumbs(width, true);
// display storage warnings
setTimeout ( "Files.displayStorageWarnings()", 100 );
@@ -424,10 +444,6 @@ function boolOperationFinished(data, callback) {
}
}
-function updateBreadcrumb(breadcrumbHtml) {
- $('p.nav').empty().html(breadcrumbHtml);
-}
-
var createDragShadow = function(event){
//select dragged file
var isDragSelected = $(event.target).parents('tr').find('td input:first').prop('checked');
@@ -690,3 +706,9 @@ function checkTrashStatus() {
}
});
}
+
+function onClickBreadcrumb(e){
+ var $el = $(e.target).closest('.crumb');
+ e.preventDefault();
+ FileList.changeDirectory(decodeURIComponent($el.data('dir')));
+}
diff --git a/apps/files/l10n/ca.php b/apps/files/l10n/ca.php
index 648ffce79d6..eb724d19548 100644
--- a/apps/files/l10n/ca.php
+++ b/apps/files/l10n/ca.php
@@ -35,6 +35,7 @@ $TRANSLATIONS = array(
"undo" => "desfés",
"_%n folder_::_%n folders_" => array("%n carpeta","%n carpetes"),
"_%n file_::_%n files_" => array("%n fitxer","%n fitxers"),
+"{dirs} and {files}" => "{dirs} i {files}",
"_Uploading %n file_::_Uploading %n files_" => array("Pujant %n fitxer","Pujant %n fitxers"),
"files uploading" => "fitxers pujant",
"'.' is an invalid file name." => "'.' és un nom no vàlid per un fitxer.",
diff --git a/apps/files/l10n/es.php b/apps/files/l10n/es.php
index 7a5785577af..ce92ff8f187 100644
--- a/apps/files/l10n/es.php
+++ b/apps/files/l10n/es.php
@@ -33,15 +33,17 @@ $TRANSLATIONS = array(
"cancel" => "cancelar",
"replaced {new_name} with {old_name}" => "reemplazado {new_name} con {old_name}",
"undo" => "deshacer",
-"_%n folder_::_%n folders_" => array("",""),
-"_%n file_::_%n files_" => array("",""),
-"_Uploading %n file_::_Uploading %n files_" => array("",""),
+"_%n folder_::_%n folders_" => array("","%n carpetas"),
+"_%n file_::_%n files_" => array("","%n archivos"),
+"{dirs} and {files}" => "{dirs} y {files}",
+"_Uploading %n file_::_Uploading %n files_" => array("Subiendo %n archivo","Subiendo %n archivos"),
"files uploading" => "subiendo archivos",
"'.' is an invalid file name." => "'.' no es un nombre de archivo válido.",
"File name cannot be empty." => "El nombre de archivo no puede estar vacío.",
"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Nombre Invalido, \"\\\", \"/\", \"<\", \">\", \":\", \"\", \"|\" \"?\" y \"*\" no están permitidos ",
"Your storage is full, files can not be updated or synced anymore!" => "Su almacenamiento está lleno, ¡no se pueden actualizar o sincronizar más!",
"Your storage is almost full ({usedSpacePercent}%)" => "Su almacenamiento está casi lleno ({usedSpacePercent}%)",
+"Encryption was disabled but your files are still encrypted. Please go to your personal settings to decrypt your files." => "El cifrado ha sido deshabilitado pero tus archivos permanecen cifrados. Por favor, ve a tus ajustes personales para descifrar tus archivos.",
"Your download is being prepared. This might take some time if the files are big." => "Su descarga está siendo preparada. Esto puede tardar algún tiempo si los archivos son grandes.",
"Name" => "Nombre",
"Size" => "Tamaño",
diff --git a/apps/files/l10n/es_AR.php b/apps/files/l10n/es_AR.php
index 1c26c10028d..d9d10362630 100644
--- a/apps/files/l10n/es_AR.php
+++ b/apps/files/l10n/es_AR.php
@@ -33,9 +33,10 @@ $TRANSLATIONS = array(
"cancel" => "cancelar",
"replaced {new_name} with {old_name}" => "se reemplazó {new_name} con {old_name}",
"undo" => "deshacer",
-"_%n folder_::_%n folders_" => array("",""),
-"_%n file_::_%n files_" => array("",""),
-"_Uploading %n file_::_Uploading %n files_" => array("",""),
+"_%n folder_::_%n folders_" => array("%n carpeta","%n carpetas"),
+"_%n file_::_%n files_" => array("%n archivo","%n archivos"),
+"{dirs} and {files}" => "{carpetas} y {archivos}",
+"_Uploading %n file_::_Uploading %n files_" => array("Subiendo %n archivo","Subiendo %n archivos"),
"files uploading" => "Subiendo archivos",
"'.' is an invalid file name." => "'.' es un nombre de archivo inválido.",
"File name cannot be empty." => "El nombre del archivo no puede quedar vacío.",
diff --git a/apps/files/l10n/et_EE.php b/apps/files/l10n/et_EE.php
index 5a2bb437d39..52ba1191706 100644
--- a/apps/files/l10n/et_EE.php
+++ b/apps/files/l10n/et_EE.php
@@ -35,6 +35,7 @@ $TRANSLATIONS = array(
"undo" => "tagasi",
"_%n folder_::_%n folders_" => array("%n kataloog","%n kataloogi"),
"_%n file_::_%n files_" => array("%n fail","%n faili"),
+"{dirs} and {files}" => "{dirs} ja {files}",
"_Uploading %n file_::_Uploading %n files_" => array("Laadin üles %n faili","Laadin üles %n faili"),
"files uploading" => "faili üleslaadimisel",
"'.' is an invalid file name." => "'.' on vigane failinimi.",
diff --git a/apps/files/l10n/fr.php b/apps/files/l10n/fr.php
index 4e3b0de112a..2d538262a0a 100644
--- a/apps/files/l10n/fr.php
+++ b/apps/files/l10n/fr.php
@@ -6,8 +6,8 @@ $TRANSLATIONS = array(
"Invalid Token" => "Jeton non valide",
"No file was uploaded. Unknown error" => "Aucun fichier n'a été envoyé. Erreur inconnue",
"There is no error, the file uploaded with success" => "Aucune erreur, le fichier a été envoyé avec succès.",
-"The uploaded file exceeds the upload_max_filesize directive in php.ini: " => "Le fichier envoyé dépasse la valeur upload_max_filesize située dans le fichier php.ini:",
-"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Le fichier envoyé dépasse la directive MAX_FILE_SIZE qui est spécifiée dans le formulaire HTML.",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini: " => "Le fichier envoyé dépasse l'instruction upload_max_filesize située dans le fichier php.ini:",
+"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Le fichier envoyé dépasse l'instruction MAX_FILE_SIZE qui est spécifiée dans le formulaire HTML.",
"The uploaded file was only partially uploaded" => "Le fichier n'a été que partiellement envoyé.",
"No file was uploaded" => "Pas de fichier envoyé.",
"Missing a temporary folder" => "Absence de dossier temporaire.",
@@ -33,15 +33,17 @@ $TRANSLATIONS = array(
"cancel" => "annuler",
"replaced {new_name} with {old_name}" => "{new_name} a été remplacé par {old_name}",
"undo" => "annuler",
-"_%n folder_::_%n folders_" => array("",""),
-"_%n file_::_%n files_" => array("",""),
-"_Uploading %n file_::_Uploading %n files_" => array("",""),
+"_%n folder_::_%n folders_" => array("%n dossier","%n dossiers"),
+"_%n file_::_%n files_" => array("%n fichier","%n fichiers"),
+"{dirs} and {files}" => "{dir} et {files}",
+"_Uploading %n file_::_Uploading %n files_" => array("Téléversement de %n fichier","Téléversement de %n fichiers"),
"files uploading" => "fichiers en cours d'envoi",
"'.' is an invalid file name." => "'.' n'est pas un nom de fichier valide.",
"File name cannot be empty." => "Le nom de fichier ne peut être vide.",
"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Nom invalide, les caractères '\\', '/', '<', '>', ':', '\"', '|', '?' et '*' ne sont pas autorisés.",
"Your storage is full, files can not be updated or synced anymore!" => "Votre espage de stockage est plein, les fichiers ne peuvent plus être téléversés ou synchronisés !",
"Your storage is almost full ({usedSpacePercent}%)" => "Votre espace de stockage est presque plein ({usedSpacePercent}%)",
+"Encryption was disabled but your files are still encrypted. Please go to your personal settings to decrypt your files." => "Le chiffrement était désactivé mais vos fichiers sont toujours chiffrés. Veuillez vous rendre sur vos Paramètres personnels pour déchiffrer vos fichiers.",
"Your download is being prepared. This might take some time if the files are big." => "Votre téléchargement est cours de préparation. Ceci peut nécessiter un certain temps si les fichiers sont volumineux.",
"Name" => "Nom",
"Size" => "Taille",
diff --git a/apps/files/l10n/gl.php b/apps/files/l10n/gl.php
index 6ec1816308a..01a6b54f842 100644
--- a/apps/files/l10n/gl.php
+++ b/apps/files/l10n/gl.php
@@ -35,6 +35,7 @@ $TRANSLATIONS = array(
"undo" => "desfacer",
"_%n folder_::_%n folders_" => array("%n cartafol","%n cartafoles"),
"_%n file_::_%n files_" => array("%n ficheiro","%n ficheiros"),
+"{dirs} and {files}" => "{dirs} e {files}",
"_Uploading %n file_::_Uploading %n files_" => array("Cargando %n ficheiro","Cargando %n ficheiros"),
"files uploading" => "ficheiros enviándose",
"'.' is an invalid file name." => "«.» é un nome de ficheiro incorrecto",
diff --git a/apps/files/l10n/ku_IQ.php b/apps/files/l10n/ku_IQ.php
index 9ec565da441..d98848a71f0 100644
--- a/apps/files/l10n/ku_IQ.php
+++ b/apps/files/l10n/ku_IQ.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"URL cannot be empty." => "ناونیشانی به‌سته‌ر نابێت به‌تاڵ بێت.",
"Error" => "هه‌ڵه",
+"Share" => "هاوبەشی کردن",
"_%n folder_::_%n folders_" => array("",""),
"_%n file_::_%n files_" => array("",""),
"_Uploading %n file_::_Uploading %n files_" => array("",""),
diff --git a/apps/files/l10n/lt_LT.php b/apps/files/l10n/lt_LT.php
index 0530adc2ae2..83ed8e8688f 100644
--- a/apps/files/l10n/lt_LT.php
+++ b/apps/files/l10n/lt_LT.php
@@ -2,6 +2,8 @@
$TRANSLATIONS = array(
"Could not move %s - File with this name already exists" => "Nepavyko perkelti %s - failas su tokiu pavadinimu jau egzistuoja",
"Could not move %s" => "Nepavyko perkelti %s",
+"Unable to set upload directory." => "Nepavyksta nustatyti įkėlimų katalogo.",
+"Invalid Token" => "Netinkamas ženklas",
"No file was uploaded. Unknown error" => "Failai nebuvo įkelti dėl nežinomos priežasties",
"There is no error, the file uploaded with success" => "Failas įkeltas sėkmingai, be klaidų",
"The uploaded file exceeds the upload_max_filesize directive in php.ini: " => "Įkeliamas failas yra didesnis nei leidžia upload_max_filesize php.ini faile:",
@@ -31,19 +33,22 @@ $TRANSLATIONS = array(
"cancel" => "atšaukti",
"replaced {new_name} with {old_name}" => "pakeiskite {new_name} į {old_name}",
"undo" => "anuliuoti",
-"_%n folder_::_%n folders_" => array("","",""),
-"_%n file_::_%n files_" => array("","",""),
-"_Uploading %n file_::_Uploading %n files_" => array("","",""),
+"_%n folder_::_%n folders_" => array("%n aplankas","%n aplankai","%n aplankų"),
+"_%n file_::_%n files_" => array("%n failas","%n failai","%n failų"),
+"{dirs} and {files}" => "{dirs} ir {files}",
+"_Uploading %n file_::_Uploading %n files_" => array("Įkeliamas %n failas","Įkeliami %n failai","Įkeliama %n failų"),
"files uploading" => "įkeliami failai",
"'.' is an invalid file name." => "'.' yra neleidžiamas failo pavadinime.",
"File name cannot be empty." => "Failo pavadinimas negali būti tuščias.",
"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Neleistinas pavadinimas, '\\', '/', '<', '>', ':', '\"', '|', '?' ir '*' yra neleidžiami.",
"Your storage is full, files can not be updated or synced anymore!" => "Jūsų visa vieta serveryje užimta",
"Your storage is almost full ({usedSpacePercent}%)" => "Jūsų vieta serveryje beveik visa užimta ({usedSpacePercent}%)",
+"Encryption was disabled but your files are still encrypted. Please go to your personal settings to decrypt your files." => "Šifravimas buvo išjungtas, bet Jūsų failai vis dar užšifruoti. Prašome eiti į asmeninius nustatymus ir iššifruoti savo failus.",
"Your download is being prepared. This might take some time if the files are big." => "Jūsų atsisiuntimas yra paruošiamas. tai gali užtrukti jei atsisiunčiamas didelis failas.",
"Name" => "Pavadinimas",
"Size" => "Dydis",
"Modified" => "Pakeista",
+"%s could not be renamed" => "%s negali būti pervadintas",
"Upload" => "Įkelti",
"File handling" => "Failų tvarkymas",
"Maximum upload size" => "Maksimalus įkeliamo failo dydis",
diff --git a/apps/files/l10n/nl.php b/apps/files/l10n/nl.php
index 9fb13517369..8e9454e7945 100644
--- a/apps/files/l10n/nl.php
+++ b/apps/files/l10n/nl.php
@@ -35,6 +35,7 @@ $TRANSLATIONS = array(
"undo" => "ongedaan maken",
"_%n folder_::_%n folders_" => array("","%n mappen"),
"_%n file_::_%n files_" => array("","%n bestanden"),
+"{dirs} and {files}" => "{dirs} en {files}",
"_Uploading %n file_::_Uploading %n files_" => array("%n bestand aan het uploaden","%n bestanden aan het uploaden"),
"files uploading" => "bestanden aan het uploaden",
"'.' is an invalid file name." => "'.' is een ongeldige bestandsnaam.",
diff --git a/apps/files/l10n/nn_NO.php b/apps/files/l10n/nn_NO.php
index b1f38057a88..58aafac27c4 100644
--- a/apps/files/l10n/nn_NO.php
+++ b/apps/files/l10n/nn_NO.php
@@ -2,6 +2,8 @@
$TRANSLATIONS = array(
"Could not move %s - File with this name already exists" => "Klarte ikkje flytta %s – det finst allereie ei fil med dette namnet",
"Could not move %s" => "Klarte ikkje flytta %s",
+"Unable to set upload directory." => "Klarte ikkje å endra opplastingsmappa.",
+"Invalid Token" => "Ugyldig token",
"No file was uploaded. Unknown error" => "Ingen filer lasta opp. Ukjend feil",
"There is no error, the file uploaded with success" => "Ingen feil, fila vart lasta opp",
"The uploaded file exceeds the upload_max_filesize directive in php.ini: " => "Fila du lasta opp er større enn det «upload_max_filesize» i php.ini tillater: ",
@@ -31,19 +33,22 @@ $TRANSLATIONS = array(
"cancel" => "avbryt",
"replaced {new_name} with {old_name}" => "bytte ut {new_name} med {old_name}",
"undo" => "angre",
-"_%n folder_::_%n folders_" => array("",""),
-"_%n file_::_%n files_" => array("",""),
-"_Uploading %n file_::_Uploading %n files_" => array("",""),
+"_%n folder_::_%n folders_" => array("%n mappe","%n mapper"),
+"_%n file_::_%n files_" => array("%n fil","%n filer"),
+"{dirs} and {files}" => "{dirs} og {files}",
+"_Uploading %n file_::_Uploading %n files_" => array("Lastar opp %n fil","Lastar opp %n filer"),
"files uploading" => "filer lastar opp",
"'.' is an invalid file name." => "«.» er eit ugyldig filnamn.",
"File name cannot be empty." => "Filnamnet kan ikkje vera tomt.",
"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Ugyldig namn, «\\», «/», «<», «>», «:», «\"», «|», «?» og «*» er ikkje tillate.",
"Your storage is full, files can not be updated or synced anymore!" => "Lagringa di er full, kan ikkje lenger oppdatera eller synkronisera!",
"Your storage is almost full ({usedSpacePercent}%)" => "Lagringa di er nesten full ({usedSpacePercent} %)",
+"Encryption was disabled but your files are still encrypted. Please go to your personal settings to decrypt your files." => "Kryptering er skrudd av, men filene dine er enno krypterte. Du kan dekryptera filene i personlege innstillingar.",
"Your download is being prepared. This might take some time if the files are big." => "Gjer klar nedlastinga di. Dette kan ta ei stund viss filene er store.",
"Name" => "Namn",
"Size" => "Storleik",
"Modified" => "Endra",
+"%s could not be renamed" => "Klarte ikkje å omdøypa på %s",
"Upload" => "Last opp",
"File handling" => "Filhandtering",
"Maximum upload size" => "Maksimal opplastingsstorleik",
diff --git a/apps/files/l10n/pl.php b/apps/files/l10n/pl.php
index 4b22b080b28..d8edf7173a8 100644
--- a/apps/files/l10n/pl.php
+++ b/apps/files/l10n/pl.php
@@ -33,15 +33,17 @@ $TRANSLATIONS = array(
"cancel" => "anuluj",
"replaced {new_name} with {old_name}" => "zastąpiono {new_name} przez {old_name}",
"undo" => "cofnij",
-"_%n folder_::_%n folders_" => array("","",""),
-"_%n file_::_%n files_" => array("","",""),
-"_Uploading %n file_::_Uploading %n files_" => array("","",""),
+"_%n folder_::_%n folders_" => array("%n katalog","%n katalogi","%n katalogów"),
+"_%n file_::_%n files_" => array("%n plik","%n pliki","%n plików"),
+"{dirs} and {files}" => "{katalogi} and {pliki}",
+"_Uploading %n file_::_Uploading %n files_" => array("Wysyłanie %n pliku","Wysyłanie %n plików","Wysyłanie %n plików"),
"files uploading" => "pliki wczytane",
"'.' is an invalid file name." => "„.” jest nieprawidłową nazwą pliku.",
"File name cannot be empty." => "Nazwa pliku nie może być pusta.",
"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Nieprawidłowa nazwa. Znaki '\\', '/', '<', '>', ':', '\"', '|', '?' oraz '*' są niedozwolone.",
"Your storage is full, files can not be updated or synced anymore!" => "Magazyn jest pełny. Pliki nie mogą zostać zaktualizowane lub zsynchronizowane!",
"Your storage is almost full ({usedSpacePercent}%)" => "Twój magazyn jest prawie pełny ({usedSpacePercent}%)",
+"Encryption was disabled but your files are still encrypted. Please go to your personal settings to decrypt your files." => "Szyfrowanie zostało wyłączone, ale nadal pliki są zaszyfrowane. Przejdź do ustawień osobistych i tam odszyfruj pliki.",
"Your download is being prepared. This might take some time if the files are big." => "Pobieranie jest przygotowywane. Może to zająć trochę czasu jeśli pliki są duże.",
"Name" => "Nazwa",
"Size" => "Rozmiar",
diff --git a/apps/files/l10n/pt_BR.php b/apps/files/l10n/pt_BR.php
index 15d0c170e66..f9915f251b4 100644
--- a/apps/files/l10n/pt_BR.php
+++ b/apps/files/l10n/pt_BR.php
@@ -33,15 +33,17 @@ $TRANSLATIONS = array(
"cancel" => "cancelar",
"replaced {new_name} with {old_name}" => "Substituído {old_name} por {new_name} ",
"undo" => "desfazer",
-"_%n folder_::_%n folders_" => array("",""),
-"_%n file_::_%n files_" => array("",""),
-"_Uploading %n file_::_Uploading %n files_" => array("",""),
+"_%n folder_::_%n folders_" => array("%n pasta","%n pastas"),
+"_%n file_::_%n files_" => array("%n arquivo","%n arquivos"),
+"{dirs} and {files}" => "{dirs} e {files}",
+"_Uploading %n file_::_Uploading %n files_" => array("Enviando %n arquivo","Enviando %n arquivos"),
"files uploading" => "enviando arquivos",
"'.' is an invalid file name." => "'.' é um nome de arquivo inválido.",
"File name cannot be empty." => "O nome do arquivo não pode estar vazio.",
"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Nome inválido, '\\', '/', '<', '>', ':', '\"', '|', '?' e '*' não são permitidos.",
"Your storage is full, files can not be updated or synced anymore!" => "Seu armazenamento está cheio, arquivos não podem mais ser atualizados ou sincronizados!",
"Your storage is almost full ({usedSpacePercent}%)" => "Seu armazenamento está quase cheio ({usedSpacePercent}%)",
+"Encryption was disabled but your files are still encrypted. Please go to your personal settings to decrypt your files." => "Encriptação foi desabilitada mas seus arquivos continuam encriptados. Por favor vá a suas configurações pessoais para descriptar seus arquivos.",
"Your download is being prepared. This might take some time if the files are big." => "Seu download está sendo preparado. Isto pode levar algum tempo se os arquivos forem grandes.",
"Name" => "Nome",
"Size" => "Tamanho",
diff --git a/apps/files/l10n/ro.php b/apps/files/l10n/ro.php
index 59f6cc68499..0a96eaa2479 100644
--- a/apps/files/l10n/ro.php
+++ b/apps/files/l10n/ro.php
@@ -6,27 +6,27 @@ $TRANSLATIONS = array(
"Invalid Token" => "Jeton Invalid",
"No file was uploaded. Unknown error" => "Nici un fișier nu a fost încărcat. Eroare necunoscută",
"There is no error, the file uploaded with success" => "Nu a apărut nici o eroare, fișierul a fost încărcat cu succes",
-"The uploaded file exceeds the upload_max_filesize directive in php.ini: " => "Fisierul incarcat depaseste upload_max_filesize permisi in php.ini: ",
+"The uploaded file exceeds the upload_max_filesize directive in php.ini: " => "Fisierul incarcat depaseste marimea maxima permisa in php.ini: ",
"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" => "Fișierul are o dimensiune mai mare decât variabile MAX_FILE_SIZE specificată în formularul HTML",
"The uploaded file was only partially uploaded" => "Fișierul a fost încărcat doar parțial",
"No file was uploaded" => "Nu a fost încărcat nici un fișier",
-"Missing a temporary folder" => "Lipsește un director temporar",
-"Failed to write to disk" => "Eroare la scriere pe disc",
+"Missing a temporary folder" => "Lipsește un dosar temporar",
+"Failed to write to disk" => "Eroare la scrierea discului",
"Not enough storage available" => "Nu este suficient spațiu disponibil",
"Upload failed" => "Încărcarea a eșuat",
-"Invalid directory." => "Director invalid.",
+"Invalid directory." => "registru invalid.",
"Files" => "Fișiere",
-"Unable to upload your file as it is a directory or has 0 bytes" => "Nu s-a putut încărca fișierul tău deoarece pare să fie un director sau are 0 bytes.",
+"Unable to upload your file as it is a directory or has 0 bytes" => "lista nu se poate incarca poate fi un fisier sau are 0 bytes",
"Not enough space available" => "Nu este suficient spațiu disponibil",
"Upload cancelled." => "Încărcare anulată.",
"File upload is in progress. Leaving the page now will cancel the upload." => "Fișierul este în curs de încărcare. Părăsirea paginii va întrerupe încărcarea.",
-"URL cannot be empty." => "Adresa URL nu poate fi goală.",
+"URL cannot be empty." => "Adresa URL nu poate fi golita",
"Invalid folder name. Usage of 'Shared' is reserved by ownCloud" => "Nume de dosar invalid. Utilizarea 'Shared' e rezervată de ownCloud",
"Error" => "Eroare",
-"Share" => "Partajează",
+"Share" => "a imparti",
"Delete permanently" => "Stergere permanenta",
"Rename" => "Redenumire",
-"Pending" => "În așteptare",
+"Pending" => "in timpul",
"{new_name} already exists" => "{new_name} deja exista",
"replace" => "înlocuire",
"suggest name" => "sugerează nume",
@@ -39,10 +39,11 @@ $TRANSLATIONS = array(
"files uploading" => "fișiere se încarcă",
"'.' is an invalid file name." => "'.' este un nume invalid de fișier.",
"File name cannot be empty." => "Numele fișierului nu poate rămâne gol.",
-"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Nume invalid, '\\', '/', '<', '>', ':', '\"', '|', '?' si '*' nu sunt permise.",
-"Your storage is full, files can not be updated or synced anymore!" => "Spatiul de stocare este plin, nu mai puteti incarca s-au sincroniza alte fisiere.",
-"Your storage is almost full ({usedSpacePercent}%)" => "Spatiul de stocare este aproape plin ({usedSpacePercent}%)",
-"Your download is being prepared. This might take some time if the files are big." => "Se pregătește descărcarea. Aceasta poate să dureze ceva timp dacă fișierele sunt mari.",
+"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Nume invalide, '\\', '/', '<', '>', ':', '\"', '|', '?' si '*' nu sunt permise.",
+"Your storage is full, files can not be updated or synced anymore!" => "Spatiul de stocare este plin, fisierele nu mai pot fi actualizate sau sincronizate",
+"Your storage is almost full ({usedSpacePercent}%)" => "Spatiul de stocare este aproape plin {spatiu folosit}%",
+"Encryption was disabled but your files are still encrypted. Please go to your personal settings to decrypt your files." => "criptarea a fost disactivata dar fisierele sant inca criptate.va rog intrati in setarile personale pentru a decripta fisierele",
+"Your download is being prepared. This might take some time if the files are big." => "in curs de descarcare. Aceasta poate să dureze ceva timp dacă fișierele sunt mari.",
"Name" => "Nume",
"Size" => "Dimensiune",
"Modified" => "Modificat",
@@ -51,25 +52,25 @@ $TRANSLATIONS = array(
"File handling" => "Manipulare fișiere",
"Maximum upload size" => "Dimensiune maximă admisă la încărcare",
"max. possible: " => "max. posibil:",
-"Needed for multi-file and folder downloads." => "Necesar pentru descărcarea mai multor fișiere și a dosarelor",
-"Enable ZIP-download" => "Activează descărcare fișiere compresate",
+"Needed for multi-file and folder downloads." => "necesar la descarcarea mai multor liste si fisiere",
+"Enable ZIP-download" => "permite descarcarea codurilor ZIP",
"0 is unlimited" => "0 e nelimitat",
"Maximum input size for ZIP files" => "Dimensiunea maximă de intrare pentru fișiere compresate",
"Save" => "Salvează",
"New" => "Nou",
-"Text file" => "Fișier text",
+"Text file" => "lista",
"Folder" => "Dosar",
"From link" => "de la adresa",
"Deleted files" => "Sterge fisierele",
"Cancel upload" => "Anulează încărcarea",
-"You don’t have write permissions here." => "Nu ai permisiunea de a sterge fisiere aici.",
+"You don’t have write permissions here." => "Nu ai permisiunea de a scrie aici.",
"Nothing in here. Upload something!" => "Nimic aici. Încarcă ceva!",
"Download" => "Descarcă",
-"Unshare" => "Anulare partajare",
+"Unshare" => "Anulare",
"Delete" => "Șterge",
"Upload too large" => "Fișierul încărcat este prea mare",
"The files you are trying to upload exceed the maximum size for file uploads on this server." => "Fișierul care l-ai încărcat a depășită limita maximă admisă la încărcare pe acest server.",
-"Files are being scanned, please wait." => "Fișierele sunt scanate, te rog așteptă.",
+"Files are being scanned, please wait." => "Fișierele sunt scanate, asteptati va rog",
"Current scanning" => "În curs de scanare",
"Upgrading filesystem cache..." => "Modernizare fisiere de sistem cache.."
);
diff --git a/apps/files/l10n/sq.php b/apps/files/l10n/sq.php
index ff09e7b4f95..3207e3a165c 100644
--- a/apps/files/l10n/sq.php
+++ b/apps/files/l10n/sq.php
@@ -2,6 +2,8 @@
$TRANSLATIONS = array(
"Could not move %s - File with this name already exists" => "%s nuk u spostua - Aty ekziston një skedar me të njëjtin emër",
"Could not move %s" => "%s nuk u spostua",
+"Unable to set upload directory." => "Nuk është i mundur caktimi i dosjes së ngarkimit.",
+"Invalid Token" => "Përmbajtje e pavlefshme",
"No file was uploaded. Unknown error" => "Nuk u ngarkua asnjë skedar. Veprim i gabuar i panjohur",
"There is no error, the file uploaded with success" => "Nuk pati veprime të gabuara, skedari u ngarkua me sukses",
"The uploaded file exceeds the upload_max_filesize directive in php.ini: " => "Skedari i ngarkuar tejkalon udhëzimin upload_max_filesize tek php.ini:",
@@ -11,6 +13,7 @@ $TRANSLATIONS = array(
"Missing a temporary folder" => "Një dosje e përkohshme nuk u gjet",
"Failed to write to disk" => "Ruajtja në disk dështoi",
"Not enough storage available" => "Nuk ka mbetur hapësirë memorizimi e mjaftueshme",
+"Upload failed" => "Ngarkimi dështoi",
"Invalid directory." => "Dosje e pavlefshme.",
"Files" => "Skedarët",
"Unable to upload your file as it is a directory or has 0 bytes" => "Nuk është i mundur ngarkimi i skedarit tuaj sepse është dosje ose ka dimension 0 byte",
@@ -18,6 +21,7 @@ $TRANSLATIONS = array(
"Upload cancelled." => "Ngarkimi u anulua.",
"File upload is in progress. Leaving the page now will cancel the upload." => "Ngarkimi i skedarit është në vazhdim. Nqse ndërroni faqen tani ngarkimi do të anulohet.",
"URL cannot be empty." => "URL-i nuk mund të jetë bosh.",
+"Invalid folder name. Usage of 'Shared' is reserved by ownCloud" => "Emri i dosjes është i pavlefshëm. Përdorimi i \"Shared\" është i rezervuar nga Owncloud-i",
"Error" => "Veprim i gabuar",
"Share" => "Nda",
"Delete permanently" => "Elimino përfundimisht",
@@ -29,19 +33,22 @@ $TRANSLATIONS = array(
"cancel" => "anulo",
"replaced {new_name} with {old_name}" => "U zëvëndësua {new_name} me {old_name}",
"undo" => "anulo",
-"_%n folder_::_%n folders_" => array("",""),
-"_%n file_::_%n files_" => array("",""),
-"_Uploading %n file_::_Uploading %n files_" => array("",""),
+"_%n folder_::_%n folders_" => array("%n dosje","%n dosje"),
+"_%n file_::_%n files_" => array("%n skedar","%n skedarë"),
+"{dirs} and {files}" => "{dirs} dhe {files}",
+"_Uploading %n file_::_Uploading %n files_" => array("Po ngarkoj %n skedar","Po ngarkoj %n skedarë"),
"files uploading" => "po ngarkoj skedarët",
"'.' is an invalid file name." => "'.' është emër i pavlefshëm.",
"File name cannot be empty." => "Emri i skedarit nuk mund të jetë bosh.",
"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Emër i pavlefshëm, '\\', '/', '<', '>', ':', '\"', '|', '?' dhe '*' nuk lejohen.",
"Your storage is full, files can not be updated or synced anymore!" => "Hapësira juaj e memorizimit është plot, nuk mund të ngarkoni apo sinkronizoni më skedarët.",
"Your storage is almost full ({usedSpacePercent}%)" => "Hapësira juaj e memorizimit është gati plot ({usedSpacePercent}%)",
+"Encryption was disabled but your files are still encrypted. Please go to your personal settings to decrypt your files." => "Kodifikimi u çaktivizua por skedarët tuaj vazhdojnë të jenë të kodifikuar. Ju lutem shkoni tek parametrat personale për të dekodifikuar skedarët tuaj.",
"Your download is being prepared. This might take some time if the files are big." => "Shkarkimi juaj po përgatitet. Mund të duhet pak kohë nqse skedarët janë të mëdhenj.",
"Name" => "Emri",
"Size" => "Dimensioni",
"Modified" => "Modifikuar",
+"%s could not be renamed" => "Nuk është i mundur riemërtimi i %s",
"Upload" => "Ngarko",
"File handling" => "Trajtimi i skedarit",
"Maximum upload size" => "Dimensioni maksimal i ngarkimit",
diff --git a/apps/files/l10n/uk.php b/apps/files/l10n/uk.php
index 781590cff35..bea1d930799 100644
--- a/apps/files/l10n/uk.php
+++ b/apps/files/l10n/uk.php
@@ -2,6 +2,7 @@
$TRANSLATIONS = array(
"Could not move %s - File with this name already exists" => "Не вдалося перемістити %s - Файл з таким ім'ям вже існує",
"Could not move %s" => "Не вдалося перемістити %s",
+"Unable to set upload directory." => "Не вдалося встановити каталог завантаження.",
"No file was uploaded. Unknown error" => "Не завантажено жодного файлу. Невідома помилка",
"There is no error, the file uploaded with success" => "Файл успішно вивантажено без помилок.",
"The uploaded file exceeds the upload_max_filesize directive in php.ini: " => "Розмір звантаження перевищує upload_max_filesize параметра в php.ini: ",
diff --git a/apps/files/lib/helper.php b/apps/files/lib/helper.php
index 7135ef9f656..3c13b8ea6e2 100644
--- a/apps/files/lib/helper.php
+++ b/apps/files/lib/helper.php
@@ -17,4 +17,120 @@ class Helper
'maxHumanFilesize' => $maxHumanFilesize,
'usedSpacePercent' => (int)$storageInfo['relative']);
}
+
+ public static function determineIcon($file) {
+ if($file['type'] === 'dir') {
+ $dir = $file['directory'];
+ $absPath = \OC\Files\Filesystem::getView()->getAbsolutePath($dir.'/'.$file['name']);
+ $mount = \OC\Files\Filesystem::getMountManager()->find($absPath);
+ if (!is_null($mount)) {
+ $sid = $mount->getStorageId();
+ if (!is_null($sid)) {
+ $sid = explode(':', $sid);
+ if ($sid[0] === 'shared') {
+ return \OC_Helper::mimetypeIcon('dir-shared');
+ }
+ if ($sid[0] !== 'local') {
+ return \OC_Helper::mimetypeIcon('dir-external');
+ }
+ }
+ }
+ return \OC_Helper::mimetypeIcon('dir');
+ }
+
+ if($file['isPreviewAvailable']) {
+ $relativePath = substr($file['path'], 6);
+ return \OC_Helper::previewIcon($relativePath);
+ }
+ return \OC_Helper::mimetypeIcon($file['mimetype']);
+ }
+
+ /**
+ * Comparator function to sort files alphabetically and have
+ * the directories appear first
+ * @param array $a file
+ * @param array $b file
+ * @return -1 if $a must come before $b, 1 otherwise
+ */
+ public static function fileCmp($a, $b) {
+ if ($a['type'] === 'dir' and $b['type'] !== 'dir') {
+ return -1;
+ } elseif ($a['type'] !== 'dir' and $b['type'] === 'dir') {
+ return 1;
+ } else {
+ return strnatcasecmp($a['name'], $b['name']);
+ }
+ }
+
+ /**
+ * Retrieves the contents of the given directory and
+ * returns it as a sorted array.
+ * @param string $dir path to the directory
+ * @return array of files
+ */
+ public static function getFiles($dir) {
+ $content = \OC\Files\Filesystem::getDirectoryContent($dir);
+ $files = array();
+
+ foreach ($content as $i) {
+ $i['date'] = \OCP\Util::formatDate($i['mtime']);
+ if ($i['type'] === 'file') {
+ $fileinfo = pathinfo($i['name']);
+ $i['basename'] = $fileinfo['filename'];
+ if (!empty($fileinfo['extension'])) {
+ $i['extension'] = '.' . $fileinfo['extension'];
+ } else {
+ $i['extension'] = '';
+ }
+ }
+ $i['directory'] = $dir;
+ $i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($i['mimetype']);
+ $i['icon'] = \OCA\files\lib\Helper::determineIcon($i);
+ $files[] = $i;
+ }
+
+ usort($files, array('\OCA\files\lib\Helper', 'fileCmp'));
+
+ return $files;
+ }
+
+ /**
+ * 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
+ */
+ public static function makeBreadcrumb($dir){
+ $breadcrumb = array();
+ $pathtohere = '';
+ foreach (explode('/', $dir) as $i) {
+ if ($i !== '') {
+ $pathtohere .= '/' . $i;
+ $breadcrumb[] = array('dir' => $pathtohere, 'name' => $i);
+ }
+ }
+ return $breadcrumb;
+ }
+
+ /**
+ * Returns the numeric permissions for the given directory.
+ * @param string $dir directory without trailing slash
+ * @return numeric permissions
+ */
+ public static function getDirPermissions($dir){
+ $permissions = \OCP\PERMISSION_READ;
+ if (\OC\Files\Filesystem::isCreatable($dir . '/')) {
+ $permissions |= \OCP\PERMISSION_CREATE;
+ }
+ if (\OC\Files\Filesystem::isUpdatable($dir . '/')) {
+ $permissions |= \OCP\PERMISSION_UPDATE;
+ }
+ if (\OC\Files\Filesystem::isDeletable($dir . '/')) {
+ $permissions |= \OCP\PERMISSION_DELETE;
+ }
+ if (\OC\Files\Filesystem::isSharable($dir . '/')) {
+ $permissions |= \OCP\PERMISSION_SHARE;
+ }
+ return $permissions;
+ }
}
diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php
index e17273e47b1..2e4ca82c62f 100644
--- a/apps/files/templates/index.php
+++ b/apps/files/templates/index.php
@@ -1,8 +1,7 @@
<!--[if IE 8]><style>input[type="checkbox"]{padding:0;}table td{position:static !important;}</style><![endif]-->
<div id="controls">
<?php print_unescaped($_['breadcrumb']); ?>
- <?php if ($_['isCreatable']):?>
- <div class="actions <?php if (isset($_['files']) and count($_['files'])==0):?>emptyfolder<?php endif; ?>">
+ <div class="actions creatable <?php if (!$_['isCreatable']):?>hidden<?php endif; ?> <?php if (isset($_['files']) and count($_['files'])==0):?>emptycontent<?php endif; ?>">
<div id="new" class="button">
<a><?php p($l->t('New'));?></a>
<ul>
@@ -16,29 +15,23 @@
</div>
<div id="upload" class="button"
title="<?php p($l->t('Upload') . ' max. '.$_['uploadMaxHumanFilesize']) ?>">
- <form data-upload-id='1'
- id="data-upload-form"
- class="file_upload_form"
- action="<?php print_unescaped(OCP\Util::linkTo('files', 'ajax/upload.php')); ?>"
- method="post"
- enctype="multipart/form-data"
- target="file_upload_target_1">
<?php if($_['uploadMaxFilesize'] >= 0):?>
<input type="hidden" name="MAX_FILE_SIZE" id="max_upload"
value="<?php p($_['uploadMaxFilesize']) ?>">
<?php endif;?>
<!-- Send the requesttoken, this is needed for older IE versions
because they don't send the CSRF token via HTTP header in this case -->
- <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" id="requesttoken">
<input type="hidden" class="max_human_file_size"
value="(max <?php p($_['uploadMaxHumanFilesize']); ?>)">
<input type="hidden" name="dir" value="<?php p($_['dir']) ?>" id="dir">
- <input type="file" id="file_upload_start" name='files[]'/>
+ <input type="file" id="file_upload_start" name='files[]'
+ data-url="<?php print_unescaped(OCP\Util::linkTo('files', 'ajax/upload.php')); ?>" />
<a href="#" class="svg"></a>
- </form>
</div>
<?php if ($_['trash'] ): ?>
- <input id="trash" type="button" value="<?php p($l->t('Deleted files'));?>" class="button" <?php $_['trashEmpty'] ? p('disabled') : '' ?>></input>
+ <div id="trash" class="button" <?php $_['trashEmpty'] ? p('disabled') : '' ?>>
+ <a><?php p($l->t('Deleted files'));?></a>
+ </div>
<?php endif; ?>
<div id="uploadprogresswrapper">
<div id="uploadprogressbar"></div>
@@ -48,16 +41,15 @@
</div>
</div>
<div id="file_action_panel"></div>
- <?php elseif( !$_['isPublic'] ):?>
- <div class="actions"><input type="button" disabled value="<?php p($l->t('You don’t have write permissions here.'))?>"></div>
- <input type="hidden" name="dir" value="<?php p($_['dir']) ?>" id="dir">
- <?php endif;?>
+ <div class="notCreatable notPublic <?php if ($_['isCreatable'] or $_['isPublic'] ):?>hidden<?php endif; ?>">
+ <div class="actions"><input type="button" disabled value="<?php p($l->t('You don’t have write permissions here.'))?>"></div>
+ </div>
<input type="hidden" name="permissions" value="<?php p($_['permissions']); ?>" id="permissions">
</div>
-<?php if (isset($_['files']) and $_['isCreatable'] and count($_['files'])==0):?>
- <div id="emptycontent"><?php p($l->t('Nothing in here. Upload something!'))?></div>
-<?php endif; ?>
+<div id="emptycontent" <?php if (!isset($_['files']) or !$_['isCreatable'] or count($_['files']) > 0 or !$_['ajaxLoad']):?>class="hidden"<?php endif; ?>><?php p($l->t('Nothing in here. Upload something!'))?></div>
+
+<input type="hidden" id="disableSharing" data-status="<?php p($_['disableSharing']); ?>"></input>
<table id="filestable" data-allow-public-upload="<?php p($_['publicUploadEnabled'])?>" data-preview-x="36" data-preview-y="36">
<thead>
@@ -82,7 +74,7 @@
<th id="headerDate">
<span id="modified"><?php p($l->t( 'Modified' )); ?></span>
<?php if ($_['permissions'] & OCP\PERMISSION_DELETE): ?>
-<!-- NOTE: Temporary fix to allow unsharing of files in root of Shared folder -->
+<!-- NOTE: Temporary fix to allow unsharing of files in root of Shared folder -->
<?php if ($_['dir'] == '/Shared'): ?>
<span class="selectedActions"><a href="" class="delete-selected">
<?php p($l->t('Unshare'))?>
@@ -104,7 +96,7 @@
<?php print_unescaped($_['fileList']); ?>
</tbody>
</table>
-<div id="editor"></div>
+<div id="editor"></div><!-- FIXME Do not use this div in your app! It is deprecated and will be removed in the future! -->
<div id="uploadsize-message" title="<?php p($l->t('Upload too large'))?>">
<p>
<?php p($l->t('The files you are trying to upload exceed the maximum size for file uploads on this server.'));?>
@@ -120,7 +112,8 @@
</div>
<!-- config hints for javascript -->
+<input type="hidden" name="ajaxLoad" id="ajaxLoad" value="<?php p($_['ajaxLoad']); ?>" />
<input type="hidden" name="allowZipDownload" id="allowZipDownload" value="<?php p($_['allowZipDownload']); ?>" />
<input type="hidden" name="usedSpacePercent" id="usedSpacePercent" value="<?php p($_['usedSpacePercent']); ?>" />
<input type="hidden" name="encryptedFiles" id="encryptedFiles" value="<?php $_['encryptedFiles'] ? p('1') : p('0'); ?>" />
-<input type="hidden" name="encryptedFiles" id="encryptionInitStatus" value="<?php p($_['encryptionInitStatus']) ?>" /> \ No newline at end of file
+<input type="hidden" name="encryptedFiles" id="encryptionInitStatus" value="<?php p($_['encryptionInitStatus']) ?>" />
diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php
index 4076c1bb331..1e4d4d11c98 100644
--- a/apps/files/templates/part.list.php
+++ b/apps/files/templates/part.list.php
@@ -1,7 +1,7 @@
-<input type="hidden" id="disableSharing" data-status="<?php p($_['disableSharing']); ?>">
+<?php $totalfiles = 0;
+$totaldirs = 0;
+$totalsize = 0; ?>
<?php foreach($_['files'] as $file):
- //strlen('files/') => 6
- $relativePath = substr($file['path'], 6);
// the bigger the file, the darker the shade of grey; megabytes*2
$simple_size_color = intval(160-$file['size']/(1024*1024)*2);
if($simple_size_color<0) $simple_size_color = 0;
@@ -22,26 +22,7 @@
<?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($_['isPublic']): ?>
- <?php
- $relativePath = substr($relativePath, strlen($_['sharingroot']));
- ?>
- <?php if($file['isPreviewAvailable']): ?>
- style="background-image:url(<?php print_unescaped(OCP\publicPreview_icon($relativePath, $_['sharingtoken'])); ?>)"
- <?php else: ?>
- style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
- <?php endif; ?>
- <?php else: ?>
- <?php if($file['isPreviewAvailable']): ?>
- style="background-image:url(<?php print_unescaped(OCP\preview_icon($relativePath)); ?>)"
- <?php else: ?>
- style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
- <?php endif; ?>
- <?php endif; ?>
- <?php endif; ?>
+ style="background-image:url(<?php print_unescaped($file['icon']); ?>)"
>
<?php if(!isset($_['readonly']) || !$_['readonly']): ?>
<input id="select-<?php p($file['fileid']); ?>" type="checkbox" />