From d46288b0abea28a4e0184f6720e990a05d5f19a9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 23 Oct 2011 11:40:40 +0200 Subject: 'New' button, needs some css work --- core/css/styles.css | 4 ++-- core/js/js.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'core') diff --git a/core/css/styles.css b/core/css/styles.css index ea09a1f3636..7d5ff185d4e 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -32,12 +32,12 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#35537a', end /* INPUTS */ input[type="text"], input[type="password"] { cursor:text; } -input, select, .button, #quota, div.jp-progress, .pager li a { font-size:1em; width:10em; margin:.3em; padding:.6em .5em .4em; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; } +input, select, button, .button, #quota, div.jp-progress, .pager li a { font-size:1em; width:10em; margin:.3em; padding:.6em .5em .4em; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; } input[type="text"], input[type="password"], input[type="search"] { background:#f8f8f8; color:#555; cursor:text; } input[type="text"], input[type="password"], input[type="search"] { -webkit-appearance:textfield; -webkit-box-sizing:content-box; } input[type="text"]:hover, input[type="text"]:focus, input[type="password"]:hover, input[type="password"]:focus, input[type="search"]:hover, input[type="search"]:focus { background:#fff; color:#333; } -input[type="submit"], input[type="button"], .button, #quota, div.jp-progress, .pager li a { width:auto; padding:.4em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; } +input[type="submit"], input[type="button"], button, .button, #quota, div.jp-progress, .pager li a { width:auto; padding:.4em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; } input[type="submit"]:hover, input[type="submit"]:focus, input[type="button"]:hover, input[type="button"]:focus, .button:hover { background:#fff; color:#333; } input[type="checkbox"] { width:auto; } #quota { cursor:default; } diff --git a/core/js/js.js b/core/js/js.js index 9e814ca0729..8cfb58982ad 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -365,7 +365,7 @@ $(document).ready(function(){ $('.jp-controls .jp-previous').tipsy({gravity:'nw', fade:true, live:true}); $('.jp-controls .jp-next').tipsy({gravity:'n', fade:true, live:true}); $('.password .action').tipsy({gravity:'se', fade:true, live:true}); - $('.file_upload_button_wrapper').tipsy({gravity:'e', fade:true}); + $('.file_upload_button_wrapper').tipsy({gravity:'w', fade:true}); $('.selectedActions a.delete').tipsy({gravity: 'se', fade:true, live:true}); $('.selectedActions a').tipsy({gravity:'s', fade:true, live:true}); $('#headerSize').tipsy({gravity:'s', fade:true, live:true}); -- cgit v1.2.3 From 0c890a501cc7c24fb7eb5a4e4bff35dd2bb56b6d Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sun, 23 Oct 2011 21:51:56 +0200 Subject: upgraded the new new button. Didn't and doesn't work in Firefox though --- core/img/actions/upload.png | Bin 0 -> 236 bytes core/img/actions/upload.svg | 73 ++++++++++++++++++++++++++++++++++++++++++++ files/css/files.css | 13 ++++---- files/templates/index.php | 10 +++--- 4 files changed, 85 insertions(+), 11 deletions(-) create mode 100644 core/img/actions/upload.png create mode 100644 core/img/actions/upload.svg (limited to 'core') diff --git a/core/img/actions/upload.png b/core/img/actions/upload.png new file mode 100644 index 00000000000..5744aad75a8 Binary files /dev/null and b/core/img/actions/upload.png differ diff --git a/core/img/actions/upload.svg b/core/img/actions/upload.svg new file mode 100644 index 00000000000..91333bb681e --- /dev/null +++ b/core/img/actions/upload.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/files/css/files.css b/files/css/files.css index c6f76215155..0f0a3a6c585 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -4,7 +4,7 @@ /* FILE MENU */ .actions { padding:.3em; float:left; } -.actions input { margin:0; } +.actions input, .actions button { margin:0; } #file_menu { right:0; position:absolute; top:0; } #file_menu a { display:block; float:left; background-image:none; text-decoration:none; } .file_upload_form, #file_newfolder_form { display:inline; float: left; margin-left:0; } @@ -12,11 +12,11 @@ .file_upload_wrapper, #file_newfolder_name { background-repeat:no-repeat; background-position:.5em .5em; padding-left:2em; } .file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; padding-left:0; overflow:hidden; position:relative; margin:0;} .file_upload_wrapper .file_upload_button_wrapper { position:absolute; top:0; left:0; width:100%; height:100%; cursor:pointer; z-index:1000; } -#new { float:left; border-top-right-radius:0; border-bottom-right-radius:0; margin-top:-0.075em; margin-right:0; border-right:none } +#new { float:left; border-top-right-radius:0; border-bottom-right-radius:0; margin:-.075em 0 0 1em; border-right:none; z-index:1010; } #new.active { border-bottom-left-radius:0; border-bottom:none; } #new>a{ padding-left:1em; padding-right:1em; } -#new>ul { display:none; position:fixed; text-align:left; padding:0.5em; background:#f8f8f8; margin-top:0.4em; border:1px solid #ddd; min-width:7em; margin-left:-0.5em; } -#new>ul>li { margin:0.3em; padding-left:1.3em; background-repeat:no-repeat; cursor:pointer; } +#new>ul { display:none; position:fixed; text-align:left; padding:.5em; background:#f8f8f8; margin-top:.4em; border:1px solid #ddd; min-width:7em; margin-left:-.5em; z-index:-1; } +#new>ul>li { margin:.3em; padding-left:2em; background-repeat:no-repeat; cursor:pointer; } #new>ul>li>p { cursor:pointer; } #file_newfolder_name { background-image:url('../../core/img/places/folder.svg'); font-weight:normal; width:7em; } @@ -25,8 +25,9 @@ .file_upload_target { display:none; } .file_upload_start { opacity:0; filter:alpha(opacity=0); z-index:1; position:absolute; left:0; top:0; width:100%; cursor:pointer;} -input.file_upload_filename.active { border-bottom-right-radius:0 } -input.file_upload_filename { z-index:100; cursor:pointer; border-top-left-radius:0; border-bottom-left-radius:0; } +.file_upload_filename.active { border-bottom-right-radius:0 } +.file_upload_filename { z-index:100; cursor:pointer; border-top-left-radius:0; border-bottom-left-radius:0; padding:.3em; } + .file_upload_form, .file_upload_wrapper, .file_upload_start, .file_upload_filename, #file_upload_submit { cursor:pointer; } diff --git a/files/templates/index.php b/files/templates/index.php index 902c5cfa140..cb1ab688084 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -7,9 +7,9 @@ t('New');?>
@@ -17,9 +17,9 @@ - + - +
-- cgit v1.2.3 From c7d1737d47c1846beee5d145dd73dd7924a6eea9 Mon Sep 17 00:00:00 2001 From: Brice Maron Date: Tue, 1 Nov 2011 22:35:13 +0100 Subject: attempt to manage some special chars in file list Added a jquery function to filter by attributes. Add more logging in rename file Use the new function to avoid errors --- apps/files_sharing/js/share.js | 6 ++--- core/js/js.js | 7 ++++++ files/js/fileactions.js | 2 +- files/js/filelist.js | 54 ++++++++++++++++++++++++------------------ files/js/files.js | 11 ++++++--- files/templates/part.list.php | 2 +- lib/filestorage/local.php | 5 ++++ 7 files changed, 56 insertions(+), 31 deletions(-) (limited to 'core') diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index c0fc91e92ad..131571351c5 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -10,7 +10,7 @@ $(document).ready(function() { type: 'GET', url: OC.linkTo('files_sharing', 'ajax/getitem.php'), dataType: 'json', - data: 'source='+file, + data: {source: file}, async: false, success: function(users) { if (users) { @@ -184,8 +184,8 @@ function createDropdown(filename, files) { html += ''; html += ''; if (filename) { - $('tr[data-file="'+filename+'"]').addClass('mouseOver'); - $(html).appendTo($('tr[data-file="'+filename+'"] td.filename')); + $('tr').filterAttr('data-file',filename).addClass('mouseOver'); + $(html).appendTo($('tr').filterAttr('data-file',filename).find('td.filename')); } else { $(html).appendTo($('thead .share')); } diff --git a/core/js/js.js b/core/js/js.js index 9e814ca0729..440f504c8f7 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -401,3 +401,10 @@ if (!Array.prototype.map){ return res; }; } + +/** + * Filter Jquery selector by attribute value + **/ +$.fn.filterAttr = function(attr_name, attr_value) { + return this.filter(function() { return $(this).attr(attr_name) === attr_value; }); +}; diff --git a/files/js/fileactions.js b/files/js/fileactions.js index f95c5e84dc1..9e2688e82c1 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -56,7 +56,7 @@ FileActions={ $('#fileList .action').remove(); var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); var file=FileActions.getCurrentFile(); - if($('tr[data-file="'+file+'"]').data('renaming')){ + if($('tr').filterAttr('data-file',file).data('renaming')){ return; } var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); diff --git a/files/js/filelist.js b/files/js/filelist.js index 863a3385d15..5740ece9716 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -4,7 +4,7 @@ FileList={ }, addFile:function(name,size,lastModified,loading){ var img=(loading)?OC.imagePath('core', 'loading.gif'):OC.imagePath('core', 'filetypes/file.png'); - var html=''; + var html=''; if(name.indexOf('.')!=-1){ var basename=name.substr(0,name.lastIndexOf('.')); var extention=name.substr(name.lastIndexOf('.')); @@ -29,16 +29,21 @@ FileList={ html+=''+simpleSize+''; html+=''+relative_modified_date(lastModified.getTime() / 1000)+''; html+=''; - FileList.insertElement(name,'file',$(html)); + FileList.insertElement(name,'file',$(html).attr('data-file',name)); if(loading){ - $('tr[data-file="'+name+'"]').data('loading',true); + $('tr').filterAttr('data-file',name).data('loading',true); }else{ - $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions); + $('tr').filterAttr('data-file',name).find('td.filename').draggable(dragOptions); } }, addDir:function(name,size,lastModified){ - var html=''; - html+=''+name+''; + html = $('').attr({ "data-type": "dir", "data-size": size, "data-file": name}); + td = $('').attr({"class": "filename", "style": 'background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')' }); + td.append(''); + var link_elem = $('').attr({ "class": "name", "href": "index.php?dir="+ encodeURIComponent($('#dir').val()+'/'+name) }); + link_elem.append($('').addClass('nametext').text(name)); + td.append(link_elem); + html.append(td); if(size!='Pending'){ simpleSize=simpleFileSize(size); }else{ @@ -47,13 +52,15 @@ FileList={ 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+=''; + td = $('').attr({ "class": "filesize", "title": humanFileSize(size), "style": 'color:rgb('+sizeColor+','+sizeColor+','+sizeColor+')'}).text(simpleSize); + html.append(td); - FileList.insertElement(name,'dir',$(html)); - $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions); - $('tr[data-file="'+name+'"] td.filename').droppable(folderDropOptions); + td = $('').attr({ "class": "date" }); + td.append($('').attr({ "class": "modified", "title": formatDate(lastModified), "style": 'color:rgb('+modifiedColor+','+modifiedColor+','+modifiedColor+')' }).text( relative_modified_date(lastModified.getTime() / 1000) )); + html.append(td); + FileList.insertElement(name,'dir',html); + $('tr').filterAttr('data-file',name).find('td.filename').draggable(dragOptions); + $('tr').filterAttr('data-file',name).find('td.filename').droppable(folderDropOptions); }, refresh:function(data) { result = jQuery.parseJSON(data.responseText); @@ -64,8 +71,8 @@ FileList={ resetFileActionPanel(); }, remove:function(name){ - $('tr[data-file="'+name+'"] td.filename').draggable('destroy'); - $('tr[data-file="'+name+'"]').remove(); + $('tr').filterAttr('data-file',name).find('td.filename').draggable('destroy'); + $('tr').filterAttr('data-file',name).remove(); if($('tr[data-file]').length==0){ $('#emptyfolder').show(); $('.file_upload_filename').addClass('highlight'); @@ -101,7 +108,7 @@ FileList={ $('.file_upload_filename').removeClass('highlight'); }, loadingDone:function(name){ - var tr=$('tr[data-file="'+name+'"]'); + var tr=$('tr').filterAttr('data-file',name); tr.data('loading',false); var mime=tr.data('mime'); tr.attr('data-mime',mime); @@ -111,13 +118,13 @@ FileList={ tr.find('td.filename').draggable(dragOptions); }, isLoading:function(name){ - return $('tr[data-file="'+name+'"]').data('loading'); + return $('tr').filterAttr('data-file',name).data('loading'); }, rename:function(name){ - var tr=$('tr[data-file="'+name+'"]'); + var tr=$('tr').filterAttr('data-file',name); tr.data('renaming',true); var td=tr.children('td.filename'); - var input=$(''); + var input=$('').val(name); var form=$('
') form.append(input); td.children('a.name').text(''); @@ -143,7 +150,7 @@ FileList={ } $.ajax({ url: 'ajax/rename.php', - data: "dir="+$('#dir').val()+"&newname="+encodeURIComponent(newname)+"&file="+encodeURIComponent(name) + data: { dir : $('#dir').val(), newname: newname, file: name } }); }); form.click(function(event){ @@ -165,9 +172,10 @@ FileList={ files=[files]; } $.each(files,function(index,file){ - $('tr[data-file="'+file+'"]').hide(); - $('tr[data-file="'+file+'"]').find('input[type="checkbox"]').removeAttr('checked'); - $('tr[data-file="'+file+'"]').removeClass('selected'); + var files = $('tr').filterAttr('data-file',file); + files.hide(); + files.find('input[type="checkbox"]').removeAttr('checked'); + files.removeClass('selected'); }); procesSelection(); FileList.deleteCanceled=false; @@ -208,7 +216,7 @@ $(document).ready(function(){ if($('#notification').data('deletefile')) { $.each(FileList.deleteFiles,function(index,file){ - $('tr[data-file="'+file+'"]').show(); + $('tr').filterAttr('data-file',file).show(); // alert(file); }); FileList.deleteCanceled=true; diff --git a/files/js/files.js b/files/js/files.js index 902c5e54934..593eeafde85 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -1,4 +1,9 @@ $(document).ready(function() { + $('#fileList tr').each(function(){ + //little hack to set unescape filenames in attribute + $(this).attr('data-file',unescape($(this).data('file'))); + }); + if($('tr[data-file]').length==0){ $('.file_upload_filename').addClass('highlight'); } @@ -185,9 +190,9 @@ $(document).ready(function() { if(response[0] != undefined && response[0].status == 'success'){ for(var i=0;i200) $relative_date_color = 200; ?> - '> + '> diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index 01523b6b0b3..9e29f85071a 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -84,6 +84,11 @@ class OC_Filestorage_Local extends OC_Filestorage{ return $return; } public function rename($path1,$path2){ + if(! $this->file_exists($path1)){ + OC_Log::write('core','unable to rename, file does not exists : '.$path1,OC_Log::ERROR); + return false; + } + if($return=rename($this->datadir.$path1,$this->datadir.$path2)){ $this->clearFolderSizeCache($path1); $this->clearFolderSizeCache($path2); -- cgit v1.2.3