From 8148c187a32e4952e150dffefecab39f1c5b323e Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Tue, 18 Dec 2012 16:10:48 +0100 Subject: whitespace cleanup --- apps/files/js/files.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 6a37d9e7f53..2ce1723f0b4 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -234,12 +234,12 @@ $(document).ready(function() { } }); }else{ - var dropTarget = $(e.originalEvent.target).closest('tr'); - if(dropTarget && dropTarget.attr('data-type') === 'dir') { // drag&drop upload to folder - var dirName = dropTarget.attr('data-file') - } + var dropTarget = $(e.originalEvent.target).closest('tr'); + if(dropTarget && dropTarget.attr('data-type') === 'dir') { // drag&drop upload to folder + var dirName = dropTarget.attr('data-file') + } - var date=new Date(); + var date=new Date(); if(files){ for(var i=0;i0){ @@ -292,9 +292,9 @@ $(document).ready(function() { var jqXHR = $('#file_upload_start').fileupload('send', {files: files[i], formData: function(form) { var formArray = form.serializeArray(); - // array index 0 contains the max files size - // array index 1 contains the request token - // array index 2 contains the directory + // array index 0 contains the max files size + // array index 1 contains the request token + // array index 2 contains the directory formArray[2]['value'] = dirName; return formArray; }}).success(function(result, textStatus, jqXHR) { @@ -305,13 +305,13 @@ $(document).ready(function() { $('#notification').fadeIn(); } var file=response[0]; - // TODO: this doesn't work if the file name has been changed server side + // TODO: this doesn't work if the file name has been changed server side delete uploadingFiles[dirName][file.name]; - if ($.assocArraySize(uploadingFiles[dirName]) == 0) { - delete uploadingFiles[dirName]; - } + if ($.assocArraySize(uploadingFiles[dirName]) == 0) { + delete uploadingFiles[dirName]; + } - var uploadtext = $('tr').filterAttr('data-type', 'dir').filterAttr('data-file', dirName).find('.uploadtext') + var uploadtext = $('tr').filterAttr('data-type', 'dir').filterAttr('data-file', dirName).find('.uploadtext') var currentUploads = parseInt(uploadtext.attr('currentUploads')); currentUploads -= 1; uploadtext.attr('currentUploads', currentUploads); @@ -434,7 +434,7 @@ $(document).ready(function() { // http://stackoverflow.com/a/6700/11236 var size = 0, key; for (key in obj) { - if (obj.hasOwnProperty(key)) size++; + if (obj.hasOwnProperty(key)) size++; } return size; }; -- cgit v1.2.3 From 32c2b0d50eac5669f64bdbf9256939d1ad046304 Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Tue, 18 Dec 2012 16:36:26 +0100 Subject: enable enter in ie by using .submit()+form instead of .change(), use notifications when name is empty --- apps/files/js/files.js | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 2ce1723f0b4..6d1be45cddc 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -496,7 +496,7 @@ $(document).ready(function() { $('#new li').each(function(i,element){ if($(element).children('p').length==0){ - $(element).children('input').remove(); + $(element).children('form').remove(); $(element).append('

'+$(element).data('text')+'

'); } }); @@ -506,22 +506,35 @@ $(document).ready(function() { $(this).data('text',text); $(this).children('p').remove(); var input=$(''); - $(this).append(input); + var form=$('
'); + form.append(input); + $(this).append(form); input.focus(); - input.change(function(){ - if (type != 'web' && Files.containsInvalidCharacters($(this).val())) { - return; - } else if( type == 'folder' && $('#dir').val() == '/' && $(this).val() == 'Shared') { + form.submit(function(event){ + event.stopPropagation(); + event.preventDefault(); + var newname=input.val(); + if(type != 'web' && Files.containsInvalidCharacters(newname)){ + return false; + } else if (newname.length == 0) { + if(type == 'web') { + $('#notification').text(t('files', "URL cannot be empty.")); + } else { + $('#notification').text(t('files', "Name cannot be empty.")); + } + $('#notification').fadeIn(); + return false; + } else if( type == 'folder' && $('#dir').val() == '/' && newname == 'Shared') { $('#notification').text(t('files','Invalid folder name. Usage of "Shared" is reserved by Owncloud')); $('#notification').fadeIn(); - return; + return false; } if (FileList.lastAction) { FileList.lastAction(); } - var name = getUniqueName($(this).val()); - if (name != $(this).val()) { - FileList.checkName(name, $(this).val(), true); + var name = getUniqueName(newname); + if (newname != name) { + FileList.checkName(name, newname, true); var hidden = true; } else { var hidden = false; @@ -604,8 +617,8 @@ $(document).ready(function() { }); break; } - var li=$(this).parent(); - $(this).remove(); + var li=form.parent(); + form.remove(); li.append('

'+li.data('text')+'

'); $('#new>a').click(); }); -- cgit v1.2.3 From 740b6623aad0b69e7f16348ad3d4a098a0a9e598 Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Tue, 18 Dec 2012 16:37:27 +0100 Subject: show notification when renaming a file to '' --- apps/files/js/filelist.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 96dd0323d29..cf86cc60979 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -151,6 +151,10 @@ var FileList={ var newname=input.val(); if (Files.containsInvalidCharacters(newname)) { return false; + } else if (newname.length == 0) { + $('#notification').text(t('files', "Name cannot be empty.")); + $('#notification').fadeIn(); + return false; } if (newname != name) { if (FileList.checkName(name, newname, false)) { -- cgit v1.2.3 From a6733ff012b2d6c41c6d551ad1353856f9dfa14b Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Tue, 18 Dec 2012 16:39:01 +0100 Subject: abort rename on ESC keyup --- apps/files/js/filelist.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index cf86cc60979..1fbfc24e1e4 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -189,6 +189,13 @@ var FileList={ td.children('a.name').show(); return false; }); + input.keyup(function(event){ + if (event.keyCode == 27) { + tr.data('renaming',false); + form.remove(); + td.children('a.name').show(); + } + }); input.click(function(event){ event.stopPropagation(); event.preventDefault(); -- cgit v1.2.3 From 4a7604daa26d9c79585aa3ba249f879b31f6eaa2 Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Wed, 2 Jan 2013 17:02:06 +0100 Subject: remove , at end of js. IE8 chokes on this --- core/js/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/js/config.js b/core/js/config.js index f7a29276f7d..563df4e6632 100644 --- a/core/js/config.js +++ b/core/js/config.js @@ -50,6 +50,6 @@ OC.AppConfig={ }, deleteApp:function(app){ OC.AppConfig.postCall('deleteApp',{app:app}); - }, + } }; //TODO OC.Preferences -- cgit v1.2.3 From 03b8a065cf37c040452b567a2a9050f637cbda94 Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Wed, 2 Jan 2013 17:02:55 +0100 Subject: input/form switching cleanup --- apps/files/css/files.css | 2 +- apps/files/js/files.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/files/css/files.css b/apps/files/css/files.css index 99c39f0acdb..f292c5c8c3f 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -21,7 +21,7 @@ #new>ul>li { height:20px; margin:.3em; padding-left:2em; padding-bottom:0.1em; background-repeat:no-repeat; cursor:pointer; } #new>ul>li>p { cursor:pointer; } -#new>ul>li>input { padding:0.3em; margin:-0.3em; } +#new>ul>li>form>input { padding:0.3em; margin:-0.3em; } #upload { height:27px; padding:0; margin-left:0.2em; overflow:hidden; diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 6d1be45cddc..c795469e2d5 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -477,7 +477,7 @@ $(document).ready(function() { $('#new').removeClass('active'); $('#new li').each(function(i,element){ if($(element).children('p').length==0){ - $(element).children('input').remove(); + $(element).children('form').remove(); $(element).append('

'+$(element).data('text')+'

'); } }); @@ -505,8 +505,8 @@ $(document).ready(function() { var text=$(this).children('p').text(); $(this).data('text',text); $(this).children('p').remove(); - var input=$(''); var form=$('
'); + var input=$(''); form.append(input); $(this).append(form); input.focus(); -- cgit v1.2.3 From fe4f056a2334f8e6d77c2327eccf9cf3ebc54965 Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Wed, 2 Jan 2013 17:04:11 +0100 Subject: use jQuery.parseJSON fallback for IE6/7/8 --- core/js/js.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/js/js.js b/core/js/js.js index 7d967321d93..5a24ba19c0c 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -343,8 +343,15 @@ if(typeof localStorage !=='undefined' && localStorage !== null){ return localStorage.setItem(OC.localStorage.namespace+name,JSON.stringify(item)); }, getItem:function(name){ - if(localStorage.getItem(OC.localStorage.namespace+name)===null){return null;} - return JSON.parse(localStorage.getItem(OC.localStorage.namespace+name)); + var item = localStorage.getItem(OC.localStorage.namespace+name); + if(item===null) { + return null; + } else if (typeof JSON === 'undefined') { + //fallback to jquery for IE6/7/8 + return $.parseJSON(item); + } else { + return JSON.parse(item); + } } }; }else{ -- cgit v1.2.3 From de496ed16dfff4905f1b1eddc9748c55d4ce2f7f Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Fri, 4 Jan 2013 13:47:47 +0100 Subject: remove initial iframe, is added automatically by jquery upload mechanism --- apps/files/templates/index.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index edf048c7e13..3bcb865ccdb 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -33,8 +33,6 @@ - -
-- cgit v1.2.3 From 9cd7bb2c8d7b7207a3c67e09158641b0c33e631d Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Fri, 4 Jan 2013 13:48:29 +0100 Subject: reverse z-index of a and input to make upload work again in ie8/9 --- apps/files/css/files.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files/css/files.css b/apps/files/css/files.css index f292c5c8c3f..36a1e5c954b 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -28,7 +28,7 @@ } #upload a { position:relative; display:block; width:100%; height:27px; - cursor:pointer; z-index:1000; + cursor:pointer; z-index:10; background-image:url('%webroot%/core/img/actions/upload.svg'); background-repeat:no-repeat; background-position:7px 6px; @@ -39,7 +39,7 @@ left:0; top:0; width:28px; height:27px; padding:0; font-size:1em; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter:alpha(opacity=0); opacity:0; - z-index:-1; position:relative; cursor:pointer; overflow:hidden; + z-index:20; position:relative; cursor:pointer; overflow:hidden; } #uploadprogresswrapper { position:absolute; right:13.5em; top:0em; } -- cgit v1.2.3 From cbb118d4a3a26c9471ffc40cc387df4333031da1 Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Mon, 7 Jan 2013 10:39:35 +0100 Subject: adapt to isFileNameValid, whitespace cleanup --- apps/files/js/filelist.js | 7 +------ apps/files/js/files.js | 40 ++++++++++++++++++---------------------- 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index c4c53ca878a..66697bbbf56 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -151,12 +151,7 @@ var FileList={ var newname=input.val(); if (!Files.isFileNameValid(newname)) { return false; - } else if (newname.length == 0) { - $('#notification').text(t('files', "Name cannot be empty.")); - $('#notification').fadeIn(); - return false; - } - if (newname != name) { + } else if (newname != name) { if (FileList.checkName(name, newname, false)) { newname = name; } else { diff --git a/apps/files/js/files.js b/apps/files/js/files.js index a824b9d3059..91204f041e5 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -26,19 +26,19 @@ Files={ }); procesSelection(); }, - isFileNameValid:function (name) { - if (name === '.') { - $('#notification').text(t('files', "'.' is an invalid file name.")); - $('#notification').fadeIn(); - return false; - } - if (name.length == 0) { - $('#notification').text(t('files', "File name cannot be empty.")); - $('#notification').fadeIn(); - return false; - } - - // check for invalid characters + isFileNameValid:function (name) { + if (name === '.') { + $('#notification').text(t('files', '\'.\' is an invalid file name.')); + $('#notification').fadeIn(); + return false; + } + if (name.length == 0) { + $('#notification').text(t('files', 'File name cannot be empty.')); + $('#notification').fadeIn(); + return false; + } + + // check for invalid characters var invalid_characters = ['\\', '/', '<', '>', ':', '"', '|', '?', '*']; for (var i = 0; i < invalid_characters.length; i++) { if (name.indexOf(invalid_characters[i]) != -1) { @@ -526,18 +526,14 @@ $(document).ready(function() { event.stopPropagation(); event.preventDefault(); var newname=input.val(); - if(type != 'web' && !Files.isFileNameValid(newname)){ - return false; - } else if (newname.length == 0) { - if(type == 'web') { - $('#notification').text(t('files', "URL cannot be empty.")); - } else { - $('#notification').text(t('files', "Name cannot be empty.")); - } + if(type == 'web' && newname.length == 0) { + $('#notification').text(t('files', 'URL cannot be empty.')); $('#notification').fadeIn(); return false; + } else if (type != 'web' && !Files.isFileNameValid(newname)) { + return false; } else if( type == 'folder' && $('#dir').val() == '/' && newname == 'Shared') { - $('#notification').text(t('files','Invalid folder name. Usage of "Shared" is reserved by Owncloud')); + $('#notification').text(t('files','Invalid folder name. Usage of \'Shared\' is reserved by Owncloud')); $('#notification').fadeIn(); return false; } -- cgit v1.2.3 From da442b024c50160be58281975a6fabe2d86a61a7 Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Mon, 7 Jan 2013 11:11:21 +0100 Subject: remove aborted uploads --- apps/files/js/files.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 91204f041e5..6d19a341e9e 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -351,6 +351,7 @@ $(document).ready(function() { } else { uploadtext.text(t('files', '{count} files uploading', {count: currentUploads})); } + delete uploadingFiles[dirName][fileName]; $('#notification').hide(); $('#notification').text(t('files', 'Upload cancelled.')); $('#notification').fadeIn(); @@ -376,6 +377,7 @@ $(document).ready(function() { } FileList.loadingDone(file.name, file.id); } else { + Files.cancelUpload(this.files[0].name); $('#notification').text(t('files', response.data.message)); $('#notification').fadeIn(); $('#fileList > tr').not('[data-mime]').fadeOut(); @@ -384,6 +386,7 @@ $(document).ready(function() { }) .error(function(jqXHR, textStatus, errorThrown) { if(errorThrown === 'abort') { + Files.cancelUpload(this.files[0].name); $('#notification').hide(); $('#notification').text(t('files', 'Upload cancelled.')); $('#notification').fadeIn(); -- cgit v1.2.3 From 3bb7ee521f38e1ab1fc7cd160dc3d0ae77f0433e Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Mon, 7 Jan 2013 12:23:29 +0100 Subject: attach max upload tipsy to div instead of a to fix tooltip not showing due to new z-index --- apps/files/js/files.js | 4 ++++ apps/files/templates/index.php | 6 +++--- core/js/js.js | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 6d19a341e9e..038660e6e49 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -322,6 +322,7 @@ $(document).ready(function() { if ($.assocArraySize(uploadingFiles[dirName]) == 0) { delete uploadingFiles[dirName]; } + //TODO update file upload size limit var uploadtext = $('tr').filterAttr('data-type', 'dir').filterAttr('data-file', dirName).find('.uploadtext') var currentUploads = parseInt(uploadtext.attr('currentUploads')); @@ -375,6 +376,7 @@ $(document).ready(function() { if(size==t('files','Pending')){ $('tr').filterAttr('data-file',file.name).find('td.filesize').text(file.size); } + //TODO update file upload size limit FileList.loadingDone(file.name, file.id); } else { Files.cancelUpload(this.files[0].name); @@ -407,8 +409,10 @@ $(document).ready(function() { if(size==t('files','Pending')){ $('tr').filterAttr('data-file',file.name).find('td.filesize').text(file.size); } + //TODO update file upload size limit FileList.loadingDone(file.name, file.id); } else { + //TODO Files.cancelUpload(/*where do we get the filename*/); $('#notification').text(t('files', response.data.message)); $('#notification').fadeIn(); $('#fileList > tr').not('[data-mime]').fadeOut(); diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 3bcb865ccdb..2e0772443f2 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -14,7 +14,8 @@ data-type='web'>

t('From link');?>

-
+
- +
diff --git a/core/js/js.js b/core/js/js.js index 9f3e8f92100..95889ac8a27 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -622,7 +622,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}); - $('#upload a').tipsy({gravity:'w', fade:true}); + $('#upload').tipsy({gravity:'w', fade:true}); $('.selectedActions a').tipsy({gravity:'s', fade:true, live:true}); $('a.delete').tipsy({gravity: 'e', fade:true, live:true}); $('a.action').tipsy({gravity:'s', fade:true, live:true}); -- cgit v1.2.3 From 0dda8f5d1c3288888f1fe96ad31d59b7ccbdc7ba Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Mon, 7 Jan 2013 13:09:52 +0100 Subject: ie8 ignores rgba, show button border in ie8 by adding second border css row --- core/css/styles.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/css/styles.css b/core/css/styles.css index 6e1cef72eda..59143f9b9a8 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -56,7 +56,7 @@ input[type="checkbox"]:hover+label, input[type="checkbox"]:focus+label { color:# /* BUTTONS */ input[type="submit"], input[type="button"], button, .button, #quota, div.jp-progress, select, .pager li a { width:auto; padding:.4em; - background-color:rgba(230,230,230,.5); font-weight:bold; color:#555; text-shadow:#fff 0 1px 0; border:1px solid rgba(180,180,180,.5); cursor:pointer; + background-color:rgba(230,230,230,.5); font-weight:bold; color:#555; text-shadow:#fff 0 1px 0; border:1px solid #bbb; border:1px solid rgba(180,180,180,.5); cursor:pointer; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; } -- cgit v1.2.3 From 7b9e6d2f2ce1503b113017db4dbe43c68da0101b Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Tue, 8 Jan 2013 00:32:41 +0100 Subject: fixing string concatenation in javascript refs https://github.com/owncloud/core/commit/ae54364d7c8baf5138d166855db6431190963886 --- apps/files/js/files.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 038660e6e49..bb298431e84 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -593,7 +593,7 @@ $(document).ready(function() { break; case 'web': if(name.substr(0,8)!='https://' && name.substr(0,7)!='http://'){ - name='http://'.name; + name='http://'+name; } var localName=name; if(localName.substr(localName.length-1,1)=='/'){//strip / -- cgit v1.2.3