From be6b5c8e774f9e389e4ff4a817caa3ebf5677182 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 21 Jul 2011 22:01:55 +0200 Subject: some work on the updated interface --- files/js/files.js | 68 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 10 deletions(-) (limited to 'files/js/files.js') diff --git a/files/js/files.js b/files/js/files.js index d4191215972..4a3de095509 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -54,24 +54,27 @@ $(document).ready(function() { $('#select_all').click(function() { if($(this).attr('checked')){ // Check all - $('td.selection input:checkbox').attr('checked', true); - $('td.selection input:checkbox').parent().parent().addClass('selected'); + $('td.filename input:checkbox').attr('checked', true); + $('td.filename input:checkbox').parent().parent().addClass('selected'); }else{ // Uncheck all - $('td.selection input:checkbox').attr('checked', false); - $('td.selection input:checkbox').parent().parent().removeClass('selected'); + $('td.filename input:checkbox').attr('checked', false); + $('td.filename input:checkbox').parent().parent().removeClass('selected'); } + procesSelection(); }); - $('td.selection input:checkbox').live('click',function() { + $('td.filename input:checkbox').live('click',function() { + var selectedCount=$('td.filename input:checkbox:checked').length; $(this).parent().parent().toggleClass('selected'); if(!$(this).attr('checked')){ $('#select_all').attr('checked',false); }else{ - if($('td.selection input:checkbox:checked').length==$('td.selection input:checkbox').length){ + if(selectedCount==$('td.filename input:checkbox').length){ $('#select_all').attr('checked',true); } } + procesSelection(); }); $('#file_newfolder_form').submit(function(event) { @@ -109,7 +112,7 @@ $(document).ready(function() { $('.download').live('click',function(event) { var files=''; - $('td.selection input:checkbox:checked').parent().parent().each(function(i,element){ + $('td.filename input:checkbox:checked').parent().parent().each(function(i,element){ files+=';'+$(element).attr('data-file'); }); files=files.substr(1);//remove leading ; @@ -121,9 +124,9 @@ $(document).ready(function() { return false; }); - $('.delete').live('click',function(event) { + $('.delete').click(function(event) { var files=''; - $('td.selection input:checkbox:checked').parent().parent().each(function(i,element){ + $('td.filename input:checkbox:checked').parent().parent().each(function(i,element){ files+=';'+$(element).attr('data-file'); }); files=files.substr(1);//remove leading ; @@ -133,7 +136,7 @@ $(document).ready(function() { data: "dir="+$('#dir').val()+"&files="+encodeURIComponent(files), complete: function(data){ boolOperationFinished(data, function(){ - $('td.selection input:checkbox:checked').parent().parent().each(function(i,element){ + $('td.filename input:checkbox:checked').parent().parent().each(function(i,element){ FileList.remove($(element).attr('data-file')); }); }); @@ -282,4 +285,49 @@ var folderDropOptions={ });} }); } +} + +function procesSelection(){ + var selectedFiles=$('tr[data-type="file"]>td.filename>input:checkbox:checked').parent().parent(); + var selectedFolders=$('tr[data-type="dir"]>td.filename>input:checkbox:checked').parent().parent(); + if(selectedFiles.length==0 && selectedFolders.length==0){ + $('#headerName>span.name').text('Name'); + $('#headerSize').text('Size (MB)'); + }else{ + var totalSize=0; + selectedFiles.each(function(){ + totalSize+=parseInt($(this).attr('data-size')); + }); + selectedFolders.each(function(){ + totalSize+=parseInt($(this).attr('data-size')); + }); + if(totalSize>0){ + totalSize = Math.round(totalSize/(1024*102.4))/10; + if(totalSize < 0.1) { + totalSize='<0.1'; + }else if(totalSize > 1000) { + totalSize= '>1000'; + } + } + $('#headerSize').text(totalSize+' (MB)'); + var selection=''; + if(selectedFiles.length>0){ + if(selectedFiles.length==1){ + selection+='1 File'; + }else{ + selection+=selectedFiles.length+' Files'; + } + if(selectedFolders.length>0){ + selection+=' ,'; + } + } + if(selectedFolders.length>0){ + if(selectedFolders.length==1){ + selection+='1 Folder'; + }else{ + selection+=selectedFolders.length+' Folders'; + } + } + $('#headerName>span.name').text(selection+' Selected'); + } } \ No newline at end of file -- cgit v1.2.3 From aa335f57d627e42b14e350f2bdf43112f1f0f2ef Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 21 Jul 2011 23:26:08 +0200 Subject: only show actions for selected file if there are selected files --- files/js/files.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'files/js/files.js') diff --git a/files/js/files.js b/files/js/files.js index 4a3de095509..b0970233739 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -293,7 +293,9 @@ function procesSelection(){ if(selectedFiles.length==0 && selectedFolders.length==0){ $('#headerName>span.name').text('Name'); $('#headerSize').text('Size (MB)'); + $('#selectedActions').hide(); }else{ + $('#selectedActions').show(); var totalSize=0; selectedFiles.each(function(){ totalSize+=parseInt($(this).attr('data-size')); -- cgit v1.2.3 From d9a79c0f7eade4915b236c1581ed30714ecab3ff Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 22 Jul 2011 00:18:41 +0200 Subject: show fileactions inline on hover --- apps/media/css/jplayer.css | 2 +- files/css/files.css | 30 +++++++++++------------------- files/js/fileactions.js | 26 ++++++++++++++++---------- files/js/files.js | 10 ++++++---- files/templates/index.php | 5 +---- 5 files changed, 35 insertions(+), 38 deletions(-) (limited to 'files/js/files.js') diff --git a/apps/media/css/jplayer.css b/apps/media/css/jplayer.css index c47d20c7228..4fd17882391 100644 --- a/apps/media/css/jplayer.css +++ b/apps/media/css/jplayer.css @@ -45,7 +45,7 @@ div.jp-interface { z-index:100; width:25em; left:201px; - top:-10px; + top:-20px; } div.jp-type-playlist{ width:100%; diff --git a/files/css/files.css b/files/css/files.css index e0b06ea0cb5..a886958f137 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -2,22 +2,17 @@ #file_menu { - display: none; - position: absolute; right:0px; - background-color: #EEE; -} - -#file_menu ul -{ - list-style-type: none; + position:absolute; + top:0; } -#file_menu li a +#file_menu a { - display: block; - padding: 0.5em 5em 0.5em 2em; - text-decoration: none; + display:block; + float:left; + background-image:none; + text-decoration: none; } .file_upload_form, #file_newfolder_form { @@ -36,12 +31,12 @@ } .file_upload_filename { - background-image:url(../img/file.png); font-weight:bold; + background-image:url("../img/file.png"); font-weight:bold; } .file_upload_start {opacity:0;filter: alpha(opacity = 0);} #file_newfolder_name { - background-image:url(../img/folder.png); font-weight:bold; + background-image:url("../img/folder.png"); font-weight:bold; width: 14em; } @@ -102,11 +97,8 @@ table td.selection, table th.selection, table td.fileaction text-align: center; } -table td.filename a -{ - display: block; - background-image: url(../img/file.png); - text-decoration: none; +td.filename{ + position:relative; } .dropArrow{ diff --git a/files/js/fileactions.js b/files/js/fileactions.js index b683dc0cd3a..3ad417c91c4 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -49,33 +49,39 @@ FileActions={ return actions[name]; }, display:function(parent){ - $('#file_menu ul').empty(); + $('#file_menu').empty(); parent.append($('#file_menu')); var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); for(name in actions){ - var html='
  • '+name+'
  • '; + var html=''+name+''; var element=$(html); element.data('action',name); element.click(function(event){ + event.stopPropagation(); event.preventDefault(); - $('#file_menu').slideToggle(250); var action=actions[$(this).data('action')]; - $('#file_menu ul').empty(); - action(FileActions.getCurrentFile()); + var currentFile=FileActions.getCurrentFile(); + FileActions.hide(); + action(currentFile); }); - $('#file_menu>ul').append(element); + $('#file_menu').append(element); } - $('#file_menu').slideToggle(250); + $('#file_menu').show(); return false; }, + hide:function(){ + $('#file_menu').hide(); + $('#file_menu').empty(); + $('body').append($('#file_menu')); + }, getCurrentFile:function(){ - return $('#file_menu').parents('tr:first').attr('data-file'); + return $('#file_menu').parent().parent().attr('data-file'); }, getCurrentMimeType:function(){ - return $('#file_menu').parents('tr:first').attr('data-mime'); + return $('#file_menu').parent().parent().attr('data-mime'); }, getCurrentType:function(){ - return $('#file_menu').parents('tr:first').attr('data-type'); + return $('#file_menu').parent().parent().attr('data-type'); } } diff --git a/files/js/files.js b/files/js/files.js index b0970233739..f1c00650d0a 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -31,11 +31,13 @@ $(document).ready(function() { }); // Sets the file-action buttons behaviour : - $('td.fileaction a').live('click',function(event) { - event.preventDefault(); - FileActions.display($(this).parent()); + $('tr').live('mouseenter',function(event) { + FileActions.display($(this).children('td.filename')); }); - + $('tr').live('mouseleave',function(event) { + FileActions.hide(); + }); + // Sets the file link behaviour : $('td.filename a').live('click',function(event) { event.preventDefault(); diff --git a/files/templates/index.php b/files/templates/index.php index 7cdb81b2d66..18b805529a9 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -43,7 +43,4 @@ -
    -
      -
    -
    + -- cgit v1.2.3 From d6bf5cd251e4b3ce8a1bbbe09a029148881eeac9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 22 Jul 2011 15:48:30 +0200 Subject: show error when trying to upload to large files --- files/css/files.css | 3 +- files/js/files.js | 75 ++++++++++++++++++++++++++++------------------- files/templates/index.php | 6 ++++ 3 files changed, 53 insertions(+), 31 deletions(-) (limited to 'files/js/files.js') diff --git a/files/css/files.css b/files/css/files.css index a886958f137..d45d93441de 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -157,4 +157,5 @@ table td.delete { background-image:url('../img/delete.png'); } #selectedActions{ float:right; display:none; -} \ No newline at end of file +} +#uploadsize-message{display:none} \ No newline at end of file diff --git a/files/js/files.js b/files/js/files.js index f1c00650d0a..dc59dda57e0 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -153,40 +153,55 @@ $(document).ready(function() { var uploadId=form.attr('data-upload-id'); var files=this.files; var target=form.children('iframe'); - target.load(function(){ - var response=jQuery.parseJSON(target.contents().find('body').text()); - //set mimetype and if needed filesize - if(response){ - for(var i=0;i$('#max_upload').val()){ + $( "#uploadsize-message" ).dialog({ + modal: true, + buttons: { + Close: function() { + $( this ).dialog( "close" ); } - FileList.loadingDone(file.name); } + }); + }else{ + target.load(function(){ + var response=jQuery.parseJSON(target.contents().find('body').text()); + //set mimetype and if needed filesize + if(response){ + for(var i=0;i0){ + var size=simpleFileSize(files[i].size); + }else{ + var size='Pending'; + } + FileList.addFile(files[i].name,size,uploadTime,true); } - }); - form.submit(); - var date=new Date(); - var uploadTime=formatDate(date); - for(var i=0;i0){ - var size=simpleFileSize(files[i].size); - }else{ - var size='Pending'; - } - FileList.addFile(files[i].name,size,uploadTime,true); + + //clone the upload form and hide the new one to allow users to start a new upload while the old one is still uploading + var clone=form.clone(); + uploadId++; + clone.attr('data-upload-id',uploadId); + clone.attr('target','file_upload_target_'+uploadId); + clone.children('iframe').attr('name','file_upload_target_'+uploadId) + clone.insertBefore(form); + form.hide(); } - - //clone the upload form and hide the new one to allow users to start a new upload while the old one is still uploading - var clone=form.clone(); - uploadId++; - clone.attr('data-upload-id',uploadId); - clone.attr('target','file_upload_target_'+uploadId); - clone.children('iframe').attr('name','file_upload_target_'+uploadId) - clone.insertBefore(form); - form.hide(); }); //add multiply file upload attribute to all browsers except konqueror (which crashes when it's used) diff --git a/files/templates/index.php b/files/templates/index.php index 18b805529a9..b0d4f556f4a 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -43,4 +43,10 @@ +
    +

    + t( 'The files you are trying to upload exceed the maximum size for file uploads on this server.' ); ?> +

    +
    + -- cgit v1.2.3 From ceb711dff4ceb02efd1c96b867df050f15ba4a93 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 22 Jul 2011 16:52:35 +0200 Subject: some work on the breadcrumb navigation for files --- core/css/styles.css | 4 ++-- core/img/breadcrumb-divider-start.png | Bin 0 -> 495 bytes files/css/files.css | 16 ++++++++++++++-- files/js/files.js | 22 ++++++++++++++++++++++ 4 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 core/img/breadcrumb-divider-start.png (limited to 'files/js/files.js') diff --git a/core/css/styles.css b/core/css/styles.css index b48092a9c07..7a26c2f6703 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -206,7 +206,7 @@ div.controls { width:100%; margin:0px; background-color:#f7f7f7; border-bottom:1 form.searchbox { display:inline; position:fixed; top:1em; right:10em; margin:0; padding:0; } /* NAVIGATION ------------------------------------------------------------- */ -#plugins { position:fixed; top:3.5em; float:left; width:15.7em; padding:0; } +#plugins { position:fixed; top:3.5em; float:left; width:15.7em; padding:0; z-index:100; } #plugins ul { list-style-type:none; border-top:1px solid #ccc; } #plugins a { display:block; padding:0.5em 0.5em 0.5em 3em; background-position:1.5em center; background-repeat:no-repeat; border-bottom:1px solid #ddd; border-top:1px solid #fff; text-decoration:none; font-size:1.2em; color:#666; } #plugins a.active, #plugins a:hover, #plugins a:focus, #plugins a.selected { background-color:#ccc; border-top:1px solid #ccc; border-bottom:1px solid #ccc; color:#000; outline:0; } @@ -219,7 +219,7 @@ form.searchbox { display:inline; position:fixed; top:1em; right:10em; margin:0; /* NAVIGATION BAR */ -span.nav { padding:1em 0 0 2em; } +span.nav { display:block; float:left; /*margin-right:55em;*/ } span.nav a { padding:0.5em 1.5em 0.5em 0.5em; background-position:right center; background-repeat:no-repeat; background-image:url('../img/arrow.png'); text-decoration:none; } span.nav a img { height:16px; vertical-align:text-top; } diff --git a/core/img/breadcrumb-divider-start.png b/core/img/breadcrumb-divider-start.png new file mode 100644 index 00000000000..24d1eb40857 Binary files /dev/null and b/core/img/breadcrumb-divider-start.png differ diff --git a/files/css/files.css b/files/css/files.css index d45d93441de..590c7bac364 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -115,10 +115,13 @@ span.extention{ div.crumb{ float:left; + display:block; background-repeat:no-repeat; background-position:right 0px; font-size:20px; - padding:8px; + padding-top:8px; + padding-left:8px; + height:28px; /*36-8*/ } table tr.mouseOver td { background-color:#eee; } @@ -158,4 +161,13 @@ table td.delete { background-image:url('../img/delete.png'); } float:right; display:none; } -#uploadsize-message{display:none} \ No newline at end of file +#uploadsize-message{display:none} + +/* add breadcrumb divider to the File item in navigation panel */ +#plugins li:first-child{ + background-position: 15.7em 0px; + background-repeat:no-repeat; + background-image: url("/owncloud/core/img/breadcrumb-divider-start.png"); + width:15.7em; + padding-right:11px; +} diff --git a/files/js/files.js b/files/js/files.js index dc59dda57e0..49e2f412d49 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -208,6 +208,28 @@ $(document).ready(function() { if(navigator.userAgent.search(/konqueror/i)==-1){ $('.file_upload_start').attr('multiple','multiple') } + + //if the breadcrumb is to long, start by replacing foldernames with '...' except for the current folder + var crumb=$('div.crumb').first(); + while($('div.controls').height()>40 && crumb.next('div.crumb').length>0){ + crumb.children('a').text('...'); + crumb=crumb.next('div.crumb'); + } + //if that isn't enough, start removing items from the breacrumb except for the current folder and it's parent + var crumb=$('div.crumb').first(); + var next=crumb.next('div.crumb'); + while($('div.controls').height()>40 && next.next('div.crumb').length>0){ + crumb.remove(); + crumb=next; + next=crumb.next('div.crumb'); + } + //still not enough, start shorting down the current folder name + var crumb=$('div.crumb>a').last(); + while($('div.controls').height()>40 && crumb.text().length>6){ + var text=crumb.text() + text=text.substr(0,text.length-6)+'...'; + crumb.text(text); + } }); var adjustNewFolderSize = function() { -- cgit v1.2.3 From b0f166fc836129464a2bdfa03357e844568c1104 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 26 Jul 2011 16:43:12 +0200 Subject: some javascript changes --- core/js/js.js | 19 ++++++++++++ files/js/files.js | 91 +++++++++++++++++++++++++++++-------------------------- 2 files changed, 67 insertions(+), 43 deletions(-) (limited to 'files/js/files.js') diff --git a/core/js/js.js b/core/js/js.js index 9117f08349a..2dac6907d96 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -55,3 +55,22 @@ OC={ $('head').append(style); } } + +if (!Array.prototype.filter) { + Array.prototype.filter = function(fun /*, thisp*/) { + var len = this.length >>> 0; + if (typeof fun != "function") + throw new TypeError(); + + var res = []; + var thisp = arguments[1]; + for (var i = 0; i < len; i++) { + if (i in this) { + var val = this[i]; // in case fun mutates this + if (fun.call(thisp, val, i, this)) + res.push(val); + } + } + return res; + }; +} \ No newline at end of file diff --git a/files/js/files.js b/files/js/files.js index 2f1ba907ba5..7842c680300 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -4,31 +4,8 @@ $(document).ready(function() { //drag/drop of files $('#fileList tr td.filename').draggable(dragOptions); $('#fileList tr[data-type="dir"] td.filename').droppable(folderDropOptions); - $('div.crumb').droppable({ - drop: function( event, ui ) { - var file=ui.draggable.text().trim(); - var target=$(this).attr('data-dir'); - var dir=$('#dir').val(); - while(dir.substr(0,1)=='/'){//remove extra leading /'s - dir=dir.substr(1); - } - dir='/'+dir; - if(dir.substr(-1,1)!='/'){ - dir=dir+'/'; - } - if(target==dir){ - return; - } - $.ajax({ - url: 'ajax/move.php', - data: "dir="+dir+"&file="+file+'&target='+target, - complete: function(data){boolOperationFinished(data, function(){ - FileList.remove(file); - });} - }); - }, - tolerance: 'pointer' - }); + $('div.crumb').droppable(crumbDropOptions); + $('#plugins>ul>li:first-child').droppable(crumbDropOptions); // Sets the file-action buttons behaviour : $('tr').live('mouseenter',function(event) { @@ -41,10 +18,10 @@ $(document).ready(function() { // Sets the file link behaviour : $('td.filename a').live('click',function(event) { event.preventDefault(); - var filename=$(this).parent().parent().attr('data-file'); + var filename=$(this).parent().parent().data('file'); if(!FileList.isLoading(filename)){ - var mime=$(this).parent().parent().attr('data-mime'); - var type=$(this).parent().parent().attr('data-type'); + var mime=$(this).parent().parent().data('mime'); + var type=$(this).parent().parent().data('type'); var action=FileActions.getDefault(mime,type); if(action){ action(filename); @@ -131,7 +108,7 @@ $(document).ready(function() { complete: function(data){ boolOperationFinished(data, function(){ $('td.filename input:checkbox:checked').parent().parent().each(function(i,element){ - FileList.remove($(element).attr('data-file')); + FileList.remove($(element).data('file')); }); }); } @@ -165,7 +142,7 @@ $(document).ready(function() { if(response){ for(var i=0;itd.filename>input:checkbox:checked').parent().parent(); - var selectedFolders=$('tr[data-type="dir"]>td.filename>input:checkbox:checked').parent().parent(); + var selected=getSelectedFiles(); + var selectedFiles=selected.filter(function(el){return el.type=='file'}); + var selectedFolders=selected.filter(function(el){return el.type=='dir'}); if(selectedFiles.length==0 && selectedFolders.length==0){ $('#headerName>span.name').text('Name'); $('#headerSize').text('Size (MB)'); @@ -328,12 +331,12 @@ function procesSelection(){ }else{ $('#selectedActions').show(); var totalSize=0; - selectedFiles.each(function(){ - totalSize+=parseInt($(this).attr('data-size')); - }); - selectedFolders.each(function(){ - totalSize+=parseInt($(this).attr('data-size')); - }); + for(var i=0;i0){ totalSize = Math.round(totalSize/(1024*102.4))/10; if(totalSize < 0.1) { @@ -370,22 +373,24 @@ function procesSelection(){ * @param string property (option) the property of the file requested * @return array * - * possible values for property: name, mime + * 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.selection input:checkbox:checked').parent().parent(); + var elements=$('td.filename input:checkbox:checked').parent().parent(); var files=[]; elements.each(function(i,element){ var file={ - name:$(element).attr('data-file'), - mime:$(element).attr('data-mime') + name:$(element).data('file'), + mime:$(element).data('mime'), + type:$(element).data('type'), + size:$(element).data('size'), }; if(property){ files.push(file[property]); }else{ - files.push(); + files.push(file); } }); return files; -- cgit v1.2.3 From 00da23faf6b17cc39c310fab163d122f646098a5 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 26 Jul 2011 17:00:29 +0200 Subject: no longer show deleted files as selected --- files/js/files.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'files/js/files.js') diff --git a/files/js/files.js b/files/js/files.js index 7842c680300..e1ac4e172fc 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -107,9 +107,11 @@ $(document).ready(function() { data: "dir="+$('#dir').val()+"&files="+encodeURIComponent(files), complete: function(data){ boolOperationFinished(data, function(){ - $('td.filename input:checkbox:checked').parent().parent().each(function(i,element){ - FileList.remove($(element).data('file')); - }); + var files=getSelectedFiles('name'); + for(var i=0;i Date: Thu, 28 Jul 2011 00:21:11 +0200 Subject: lots of small style fixes for the file list --- core/css/styles.css | 4 ++- files/css/files.css | 65 ++++++++++------------------------------------- files/js/files.js | 32 +++++++++++++---------- files/templates/index.php | 6 ++--- 4 files changed, 37 insertions(+), 70 deletions(-) (limited to 'files/js/files.js') diff --git a/core/css/styles.css b/core/css/styles.css index 7a26c2f6703..f5f54a1c9f6 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -5,7 +5,9 @@ body { background:#fefefe url('../img/body_background.jpg') repeat-y left top; f #owncloud { float:left; margin:0 0 0 2em; } h1 { margin:1em 3em 1em 0; border-bottom:1px solid #666; text-transform:uppercase; font-weight:normal; font-style:italic; color:#666; } p.center { text-align:center; } -a { color:#000; text-decoration:none; } +a { color:#000; text-decoration:none; outline:0; } +table { white-space:nowrap; } +input { background:#fff; cursor:pointer; } form#user_settings { max-width:600px; } form#user_settings p label { display:block; float:left; width:35%; padding:0.4em 0.5em 0 0; text-align:right; } diff --git a/files/css/files.css b/files/css/files.css index 590c7bac364..c00b595fd2f 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -17,7 +17,6 @@ .file_upload_form, #file_newfolder_form { display: inline; - margin-left:3em; } #fileSelector, #file_upload_submit, #file_newfolder_submit { @@ -37,14 +36,14 @@ #file_newfolder_name { background-image:url("../img/folder.png"); font-weight:bold; - width: 14em; + width: 11em; } .file_upload_start, .file_upload_filename{ position:absolute; top:0px; left:0px; - width:30ex; + width:11em; font-size: 0.9em; } @@ -54,7 +53,7 @@ left:-2em; display: -moz-inline-box; /* fallback for older firefox versions*/ display: inline-block; - width:30ex; + width:12em; } #file_newfolder_submit, #file_upload_submit { @@ -76,39 +75,6 @@ table { tbody tr:hover, tbody tr:active, tbody tr.selected { background-color:#eee; } tbody a { color:#000; } -table td.filesize, table td.date -{ - width: 7em; - padding: 0.5em 1em; - text-align: right; -} -#headerSize{ - text-align:right; -} - -table td.date -{ - width: 11em; -} - -table td.selection, table th.selection, table td.fileaction -{ - width: 2em; - text-align: center; -} - -td.filename{ - position:relative; -} - -.dropArrow{ - height:16px; - width:16px; - display: -moz-inline-box; /* fallback for older firefox versions*/ - display: inline-block; - background-image:url('../img/drop-arrow.png'); -} - span.extention{ color:#999; } @@ -118,23 +84,23 @@ div.crumb{ display:block; background-repeat:no-repeat; background-position:right 0px; - font-size:20px; + font-weight:bold; padding-top:8px; padding-left:8px; height:28px; /*36-8*/ } table tr.mouseOver td { background-color:#eee; } -table th, table td { padding:0; border-bottom:1px solid #ddd; text-align:left; font-style:italic; } -table th { padding:0.5em; } +table th { padding:.5em; } +table th .name { float:left; margin-left:.5em; } +table th, table td { border-bottom:1px solid #ddd; text-align:left; font-weight:normal; } table td { border-bottom:1px solid #eee; font-style:normal; } -table td.date { width:11em; } +table th#headerSize, table td.filesize, table th#headerDate, table td.date { width:4em; padding:0 1em; text-align:right; cursor:help; } table td.selection, table th.selection, table td.fileaction { width:2em; text-align:center; } table td.filename a { display:block; background-image:url('../img/file.png'); text-decoration:none; } -table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:0.5em 0.5em 0.5em 3em; background-position:1em center; background-repeat:no-repeat; } +table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:.5em .5em .5em 3em; background-position:1em center; background-repeat:no-repeat; } table td.filename a:hover, table td.filename a:focus { outline:0; } table td.filename a:active { outline:0; } -table em { font-weight:bold; } table td.filename a.folder-up { background-image:url('../img/back.png'); font-style:italic; } table td.filename a.folder { background-image:url('../img/folder.png'); } table td.filename a.folder-home { background-image:url('../img/home.png'); } @@ -151,16 +117,11 @@ table td.download { background-image:url('../img/download.png'); } table td.upload { background-image:url('../img/upload.png'); } table td.create { background-image:url('../img/folder-new.png'); } table td.delete { background-image:url('../img/delete.png'); } -#fileList tr input[type=checkbox] { display:none; float:left; margin:0.7em; margin-left:1em; } -#fileList tr input[type=checkbox]:checked { display:inline; } -#fileList tr:hover input[type=checkbox] { display:inline; } -#fileList tr:hover td.filename a{background-image:none !important} -#fileList tr.selected td.filename a{background-image:none !important} +#fileList tr input[type=checkbox] { display:none; float:left; margin:.7em 0 0 1em; /* bigger clickable area doesn’t work in FF width:2.8em; height:2.4em;*/ } +#fileList tr input[type=checkbox]:checked, #fileList tr:hover input[type=checkbox] { display:inline; } +#fileList tr.selected td.filename a, #fileList tr:hover td.filename a{background-image:none !important} #select_all{float:left; margin:0.2em; margin-left:0.6em; } -#selectedActions{ - float:right; - display:none; -} +#selectedActions { float:right; display:none; } #uploadsize-message{display:none} /* add breadcrumb divider to the File item in navigation panel */ diff --git a/files/js/files.js b/files/js/files.js index e1ac4e172fc..23d4c0205f0 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -328,7 +328,9 @@ function procesSelection(){ var selectedFolders=selected.filter(function(el){return el.type=='dir'}); if(selectedFiles.length==0 && selectedFolders.length==0){ $('#headerName>span.name').text('Name'); - $('#headerSize').text('Size (MB)'); + $('#headerSize').text('Size MB'); + $('#headerDate').text('Modified'); + $('th').css({background:'#fff',fontWeight:'normal'}); $('#selectedActions').hide(); }else{ $('#selectedActions').show(); @@ -347,26 +349,28 @@ function procesSelection(){ totalSize= '>1000'; } } - $('#headerSize').text(totalSize+' (MB)'); + $('#headerSize').text(totalSize+' MB'); var selection=''; - if(selectedFiles.length>0){ - if(selectedFiles.length==1){ - selection+='1 File'; + if(selectedFolders.length>0){ + if(selectedFolders.length==1){ + selection+='1 folder'; }else{ - selection+=selectedFiles.length+' Files'; + selection+=selectedFolders.length+' folders'; } - if(selectedFolders.length>0){ - selection+=' ,'; + if(selectedFiles.length>0){ + selection+=' & '; } } - if(selectedFolders.length>0){ - if(selectedFolders.length==1){ - selection+='1 Folder'; + if(selectedFiles.length>0){ + if(selectedFiles.length==1){ + selection+='1 file'; }else{ - selection+=selectedFolders.length+' Folders'; + selection+=selectedFiles.length+' files'; } } - $('#headerName>span.name').text(selection+' Selected'); + $('#headerName>span.name').text(selection); + $('#headerDate').text(''); + $('th').css({background:'#ddd', fontWeight:'bold'}); } } @@ -396,4 +400,4 @@ function getSelectedFiles(property){ } }); return files; -} \ No newline at end of file +} diff --git a/files/templates/index.php b/files/templates/index.php index b0d4f556f4a..e0c4fd39c15 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -34,8 +34,8 @@ Delete - t( 'Size (MB)' ); ?> - t( 'Modified' ); ?> + t( 'Size MB' ); ?> + t( 'Modified' ); ?> @@ -43,7 +43,7 @@ -
    +

    t( 'The files you are trying to upload exceed the maximum size for file uploads on this server.' ); ?>

    -- cgit v1.2.3 From 43f99a89839d43ef042397b5b7d71f85453c7399 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Thu, 28 Jul 2011 12:14:55 +0200 Subject: finished action icons on hover, small style improvements --- core/css/styles.css | 2 +- files/css/files.css | 20 ++++++++++---------- files/js/files.js | 8 ++++---- files/templates/index.php | 9 ++++----- files/templates/part.list.php | 4 +++- 5 files changed, 22 insertions(+), 21 deletions(-) (limited to 'files/js/files.js') diff --git a/core/css/styles.css b/core/css/styles.css index 0e4ac7ac3eb..6c07c48b8a6 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -74,7 +74,7 @@ background: linear-gradient(top, #35537a 0%,#1d2d42 100%); /* W3C */ } #metanav { float:right; position:relative; top:0.5em; right:2.5em; list-style:none; margin:0; padding:0; } #metanav li { display:inline; } #metanav li a { margin:.2em; padding:.7em; } -#metanav li a:hover, #metanav li a:focus { background:rgba(0,0,0,.5); -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; outline:0; box-shadow:#555 0 1px 0; -moz-box-shadow:#555 0 1px 0; -webkit-box-shadow:#555 0 1px 0; } +#metanav li a:hover, #metanav li a:focus { background:rgba(0,0,0,.5); -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:#555 0 1px 0; -moz-box-shadow:#555 0 1px 0; -webkit-box-shadow:#555 0 1px 0; } #metanav li a img { vertical-align:middle; } /* SEARCH --------------------------------------------------------------------- */ diff --git a/files/css/files.css b/files/css/files.css index 31f041884fd..c66a42a9d33 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -16,20 +16,20 @@ table { position:relative; top:37px; width:100%; } tbody tr:hover, tbody tr:active, tbody tr.selected { background-color:#eee; } tbody a { color:#000; } - -span.extention { color:#999; } +span.extention, td.date { color:#999; } div.crumb { float:left; display:block; background-repeat:no-repeat; background-position:right 0px; font-weight:bold; padding-top:8px; padding-left:8px; height:28px; /*36-8*/ } table tr.mouseOver td { background-color:#eee; } table th { padding:.5em; } table th .name { float:left; margin-left:.5em; } table th, table td { border-bottom:1px solid #ddd; text-align:left; font-weight:normal; } table td { border-bottom:1px solid #eee; font-style:normal; } -table th#headerSize, table td.filesize, table th#headerDate, table td.date { width:5em; padding:0 1em; text-align:right; cursor:help; } +table th#headerSize, table td.filesize { width:5em; padding:0 1em; text-align:right; cursor:help; } +table th#headerDate, table td.date { width:15em; padding:0 .1em 0 1em; text-align:left; } table td.selection, table th.selection, table td.fileaction { width:2em; text-align:center; } -table td.filename a.name { display:block; background-image:url('../img/file.png'); text-decoration:none; } -table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:.5em .5em .5em 3em; background-position:1em center; background-repeat:no-repeat; } -table td.filename a:hover, table td.filename a:focus { outline:0; } -table td.filename a:active { outline:0; } +table td.filename a.name { display:block; background-image:url('../img/file.png'); } +table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:.3em .5em .5em 3em; background-position:1em .5em; background-repeat:no-repeat; } +table td.filename .nametext, .modified { float:left; padding:.3em 0; } +table td.filename .nametext { width:80%; } table td.filename a.folder-up { background-image:url('../img/back.png'); font-style:italic; } table td.filename a.folder { background-image:url('../img/folder.png'); } table td.filename a.folder-home { background-image:url('../img/home.png'); } @@ -50,10 +50,10 @@ table td.delete { background-image:url('../img/delete.png'); } #fileList tr input[type=checkbox]:checked, #fileList tr:hover input[type=checkbox] { display:inline; } #fileList tr.selected td.filename a, #fileList tr:hover td.filename a { background-image:none !important } #select_all { float:left; margin:0.2em; margin-left:0.6em; } -#selectedActions { float:right; display:none; } -#selectedActions a { margin:0 .5em; } #uploadsize-message { display:none; } -a.file_action { float:right; display:inline; padding:3px !important } +.selectedActions a, a.file_action { float:right; display:inline; margin:0 .5em; padding:.3em .3em 0 .3em !important; } +.selectedActions { display:none; } +.selectedActions a:hover, a.file_action:hover { background:#fff; -moz-box-shadow:0 0 10px #fff; -webkit-box-shadow:0 0 10px #fff; box-shadow:0 0 10px #fff; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; } /* add breadcrumb divider to the File item in navigation panel */ #plugins li:first-child { background-position:15.7em 0px; background-repeat:no-repeat; background-image:url("/owncloud/core/img/breadcrumb-divider-start.png"); width:15.7em; padding-right:11px; } diff --git a/files/js/files.js b/files/js/files.js index 23d4c0205f0..e9ae0ecd012 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -329,11 +329,11 @@ function procesSelection(){ if(selectedFiles.length==0 && selectedFolders.length==0){ $('#headerName>span.name').text('Name'); $('#headerSize').text('Size MB'); - $('#headerDate').text('Modified'); + $('#modified').text('Modified'); $('th').css({background:'#fff',fontWeight:'normal'}); - $('#selectedActions').hide(); + $('.selectedActions').hide(); }else{ - $('#selectedActions').show(); + $('.selectedActions').show(); var totalSize=0; for(var i=0;ispan.name').text(selection); - $('#headerDate').text(''); + $('#modified').text(''); $('th').css({background:'#ddd', fontWeight:'bold'}); } } diff --git a/files/templates/index.php b/files/templates/index.php index ac890257394..c098a4e0632 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -28,14 +28,13 @@ t( 'Name' ); ?> - - Download - - Delete + + Download + t( 'Size MB' ); ?> - t( 'Modified' ); ?> + t( 'Modified' ); ?>Delete diff --git a/files/templates/part.list.php b/files/templates/part.list.php index cce0080b4db..1d78b77ae3e 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -5,14 +5,16 @@ + + - + -- cgit v1.2.3 From 4028178982ce79824c5420ffabb52804ef6fe573 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 28 Jul 2011 23:52:49 +0200 Subject: fix serveral styling issues on uploaded files --- files/js/filelist.js | 22 ++++++++++++++++++++-- files/js/files.js | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'files/js/files.js') diff --git a/files/js/filelist.js b/files/js/filelist.js index 8a73d83996e..e4ec97e5068 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -5,8 +5,26 @@ FileList={ addFile:function(name,size,lastModified,loading){ var img=(loading)?'img/loading.gif':'img/file.png'; var html=''; - html+=''+name+''; - html+=''+size+''; + if(name.indexOf('.')!=-1){ + var basename=name.substr(0,name.indexOf('.')); + var extention=name.substr(name.indexOf('.')); + }else{ + var basename=name; + var extention=false; + } + html+=''; + html+=''+basename + if(extention){ + html+=''+extention+''; + } + html+=''; + if(size!='Pending'){ + simpleSize=simpleFileSize(size); + }else{ + simpleSize='Pending'; + } + sizeColor = Math.round(200-Math.pow((size/(1024*1024)),2)); + html+=''+simpleSize+''; html+=''+lastModified+''; html+=''; FileList.insertElement(name,'file',$(html)); diff --git a/files/js/files.js b/files/js/files.js index e9ae0ecd012..44ec0b23846 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -157,7 +157,7 @@ $(document).ready(function() { var uploadTime=formatDate(date); for(var i=0;i0){ - var size=simpleFileSize(files[i].size); + var size=files[i].size; }else{ var size='Pending'; } -- cgit v1.2.3 From 433ad8c3ce80dde20e4fc0ea4cc3edaae2c0654f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 28 Jul 2011 23:56:42 +0200 Subject: add size tooltip for selected files --- files/js/files.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'files/js/files.js') diff --git a/files/js/files.js b/files/js/files.js index 44ec0b23846..f68e4d0c3cd 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -259,7 +259,7 @@ function humanFileSize(bytes){ } function simpleFileSize(bytes) { - mbytes = Math.round(bytes/(1024*1024),1); + mbytes = Math.round(bytes/(1024*1024/10))/10; if(bytes == 0) { return '0'; } else if(mbytes < 0.1) { return '< 0.1'; } else if(mbytes > 1000) { return '> 1000'; } @@ -341,15 +341,9 @@ function procesSelection(){ for(var i=0;i0){ - totalSize = Math.round(totalSize/(1024*102.4))/10; - if(totalSize < 0.1) { - totalSize='<0.1'; - }else if(totalSize > 1000) { - totalSize= '>1000'; - } - } - $('#headerSize').text(totalSize+' MB'); + simpleSize=simpleFileSize(totalSize); + $('#headerSize').text(simpleSize+' MB'); + $('#headerSize').attr('title',humanFileSize(totalSize)); var selection=''; if(selectedFolders.length>0){ if(selectedFolders.length==1){ -- cgit v1.2.3 From c73dd86713de9e249bee432f7728dfd06859fac3 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 29 Jul 2011 00:26:23 +0200 Subject: confirmation dialogs for deletions --- files/css/files.css | 2 +- files/js/fileactions.js | 28 +++++++++++++++++++++------- files/js/files.js | 47 ++++++++++++++++++++++++++++++++++------------- files/templates/index.php | 4 ++++ 4 files changed, 60 insertions(+), 21 deletions(-) (limited to 'files/js/files.js') diff --git a/files/css/files.css b/files/css/files.css index 166baebf861..d79e75468a5 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -51,7 +51,7 @@ table td.delete { background-image:url('../img/delete.png'); } #fileList tr input[type=checkbox]:checked, #fileList tr:hover input[type=checkbox] { display:inline; } #fileList tr.selected td.filename a, #fileList tr:hover td.filename a { background-image:none !important } #select_all { float:left; margin:0.2em; margin-left:0.6em; } -#uploadsize-message { display:none; } +#uploadsize-message,#delete-confirm { display:none; } .selectedActions a, a.file_action { float:right; display:inline; margin:0 .5em; padding:.3em .3em 0 .3em !important; } .selectedActions { display:none; } .selectedActions a:hover, a.file_action:hover { background:#fff; -moz-box-shadow:0 0 10px #fff; -webkit-box-shadow:0 0 10px #fff; box-shadow:0 0 10px #fff; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; } diff --git a/files/js/fileactions.js b/files/js/fileactions.js index 1eb885f06de..e1f25885fec 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -114,13 +114,27 @@ FileActions.register('all','Download',OC.imagePath('core','actions/download'),fu }); FileActions.register('all','Delete',OC.imagePath('core','actions/delete'),function(filename){ - $.ajax({ - url: 'ajax/delete.php', - data: "dir="+encodeURIComponent($('#dir').val())+"&file="+encodeURIComponent(filename), - complete: function(data){ - boolOperationFinished(data, function(){ - FileList.remove(filename); - }); + $( "#delete-confirm" ).dialog({ + resizable: false, + height:200, + title:"Delete "+filename, + modal: true, + buttons: { + "Delete": function() { + $( this ).dialog( "close" ); + $.ajax({ + url: 'ajax/delete.php', + data: "dir="+encodeURIComponent($('#dir').val())+"&file="+encodeURIComponent(filename), + complete: function(data){ + boolOperationFinished(data, function(){ + FileList.remove(filename); + }); + } + }); + }, + Cancel: function() { + $( this ).dialog( "close" ); + } } }); }); diff --git a/files/js/files.js b/files/js/files.js index f68e4d0c3cd..cd1689a2dd7 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -100,19 +100,40 @@ $(document).ready(function() { }); $('.delete').click(function(event) { - var files=getSelectedFiles('name').join(';'); - - $.ajax({ - url: 'ajax/delete.php', - data: "dir="+$('#dir').val()+"&files="+encodeURIComponent(files), - complete: function(data){ - boolOperationFinished(data, function(){ - var files=getSelectedFiles('name'); - for(var i=0;i0){ + fileNames=fileNames.join(', ')+' and '+lastFileName; + }else{ + fileNames=lastFileName; + } + + $( "#delete-confirm" ).dialog({ + resizable: false, + height:200, + modal: true, + title:"Delete "+fileNames, + buttons: { + "Delete": function() { + $( this ).dialog( "close" ); + $.ajax({ + url: 'ajax/delete.php', + data: "dir="+$('#dir').val()+"&files="+encodeURIComponent(files), + complete: function(data){ + boolOperationFinished(data, function(){ + var files=getSelectedFiles('name'); + for(var i=0;i
    +
    +

    These items will be permanently deleted and cannot be recovered. Are you sure?

    +
    + -- cgit v1.2.3 From 82261e99073047dd72ecec927f33ff5fea3cbffd Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 29 Jul 2011 01:10:08 +0200 Subject: use relative times for new upload files --- files/js/filelist.js | 16 +++++++++++++--- files/js/files.js | 29 +++++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 7 deletions(-) (limited to 'files/js/files.js') diff --git a/files/js/filelist.js b/files/js/filelist.js index e4ec97e5068..252a9c95807 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -24,8 +24,10 @@ FileList={ simpleSize='Pending'; } sizeColor = Math.round(200-Math.pow((size/(1024*1024)),2)); + lastModifiedTime=Math.round(lastModified.getTime() / 1000); + modifiedColor=Math.round((Math.round((new Date()).getTime() / 1000)-lastModifiedTime)/60/60/24*5); html+=''+simpleSize+''; - html+=''+lastModified+''; + html+=''+relative_modified_date(lastModified.getTime() / 1000)+''; html+=''; FileList.insertElement(name,'file',$(html)); if(loading){ @@ -37,8 +39,16 @@ FileList={ addDir:function(name,size,lastModified){ var html=''; html+=''+name+''; - html+=''+size+''; - html+=''+lastModified+''; + if(size!='Pending'){ + simpleSize=simpleFileSize(size); + }else{ + simpleSize='Pending'; + } + sizeColor = Math.round(200-Math.pow((size/(1024*1024)),2)); + lastModifiedTime=Math.round(lastModified.getTime() / 1000); + modifiedColor=Math.round((Math.round((new Date()).getTime() / 1000)-lastModifiedTime)/60/60/24*5); + html+=''+simpleSize+''; + html+=''+relative_modified_date(lastModified.getTime() / 1000)+''; html+=''; FileList.insertElement(name,'dir',$(html)); diff --git a/files/js/files.js b/files/js/files.js index cd1689a2dd7..60f2b2aec87 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -62,8 +62,8 @@ $(document).ready(function() { url: 'ajax/newfolder.php', data: "dir="+$('#dir').val()+"&foldername="+$('#file_newfolder_name').val(), complete: function(data){boolOperationFinished(data, function(){ - var date=formatDate(new Date()); - FileList.addDir($('#file_newfolder_name').val(),'0 B',date) + var date=new Date(); + FileList.addDir($('#file_newfolder_name').val(),0,date) });} }); $('#file_newfolder_submit').fadeOut(250).trigger('vanish'); @@ -175,14 +175,13 @@ $(document).ready(function() { }); form.submit(); var date=new Date(); - var uploadTime=formatDate(date); for(var i=0;i0){ var size=files[i].size; }else{ var size='Pending'; } - FileList.addFile(files[i].name,size,uploadTime,true); + FileList.addFile(files[i].name,size,date,true); } //clone the upload form and hide the new one to allow users to start a new upload while the old one is still uploading @@ -416,3 +415,25 @@ function getSelectedFiles(property){ }); return files; } + +function relative_modified_date(timestamp) { + var timediff = Math.round((new Date()).getTime() / 1000) - timestamp; + var diffminutes = Math.round(timediff/60); + var diffhours = Math.round(diffminutes/60); + var diffdays = Math.round(diffhours/24); + var diffmonths = Math.round(diffdays/31); + var diffyears = Math.round(diffdays/365); + if(timediff < 60) { return 'seconds ago'; } + else if(timediff < 120) { return '1 minute ago'; } + else if(timediff < 3600) { return diffminutes+' minutes ago'; } + //else if($timediff < 7200) { return '1 hour ago'; } + //else if($timediff < 86400) { return $diffhours.' hours ago'; } + else if(timediff < 86400) { return 'today'; } + else if(timediff < 172800) { return 'yesterday'; } + else if(timediff < 2678400) { return diffdays+' days ago'; } + else if(timediff < 5184000) { return 'last month'; } + //else if($timediff < 31556926) { return $diffmonths.' months ago'; } + else if(timediff < 31556926) { return 'months ago'; } + else if(timediff < 63113852) { return 'last year'; } + else { return diffyears+' years ago'; } +} -- cgit v1.2.3 From 6d0c8ea7e4c15e2a4072e0951eac3c0f64b2fbdc Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 29 Jul 2011 01:36:31 +0200 Subject: use proper file icons for image and audio files --- core/img/mimetypes/audio.png | Bin 0 -> 562 bytes core/img/mimetypes/music.png | Bin 562 -> 0 bytes files/js/filelist.js | 3 ++- files/js/files.js | 9 +++++++++ lib/helper.php | 5 +++++ 5 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 core/img/mimetypes/audio.png delete mode 100644 core/img/mimetypes/music.png (limited to 'files/js/files.js') diff --git a/core/img/mimetypes/audio.png b/core/img/mimetypes/audio.png new file mode 100644 index 00000000000..6333b947f07 Binary files /dev/null and b/core/img/mimetypes/audio.png differ diff --git a/core/img/mimetypes/music.png b/core/img/mimetypes/music.png deleted file mode 100644 index 6333b947f07..00000000000 Binary files a/core/img/mimetypes/music.png and /dev/null differ diff --git a/files/js/filelist.js b/files/js/filelist.js index 252a9c95807..a53ad672e42 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -96,7 +96,8 @@ FileList={ }, loadingDone:function(name){ $('tr[data-file="'+name+'"]').data('loading',false); - $('tr[data-file="'+name+'"] td.filename a').attr('style','background-image:url(img/file.png'); + var mime=$('tr[data-file="'+name+'"]').data('mime'); + $('tr[data-file="'+name+'"] td.filename a').attr('style','background-image:url('+getMimeIcon(mime)+')'); $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions); }, isLoading:function(name){ diff --git a/files/js/files.js b/files/js/files.js index 60f2b2aec87..193c740b6c5 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -437,3 +437,12 @@ function relative_modified_date(timestamp) { else if(timediff < 63113852) { return 'last year'; } else { return diffyears+' years ago'; } } + +function getMimeIcon(mime){ + mime=mime.substr(0,mime.indexOf('/')); + var knownMimes=['image','audio']; + if(knownMimes.indexOf(mime)==-1){ + mime='file'; + } + return OC.imagePath('core','mimetypes/'+mime+'.png'); +} \ No newline at end of file diff --git a/lib/helper.php b/lib/helper.php index 1fbcc589d10..ffb25877433 100755 --- a/lib/helper.php +++ b/lib/helper.php @@ -110,6 +110,11 @@ class OC_HELPER { if( file_exists( "$SERVERROOT/core/img/mimetypes/$mimetype.png" )){ return "$WEBROOT/core/img/mimetypes/$mimetype.png"; } + //try only the first part of the mimetype + $mimetype=substr($mimetype,0,strpos($mimetype,'-')); + if( file_exists( "$SERVERROOT/core/img/mimetypes/$mimetype.png" )){ + return "$WEBROOT/core/img/mimetypes/$mimetype.png"; + } else{ return "$WEBROOT/core/img/mimetypes/file.png"; } -- cgit v1.2.3