diff options
Diffstat (limited to 'files')
-rw-r--r-- | files/ajax/scan.php | 3 | ||||
-rw-r--r-- | files/ajax/upload.php | 4 | ||||
-rw-r--r-- | files/appinfo/app.php | 2 | ||||
-rw-r--r-- | files/css/files.css | 30 | ||||
-rw-r--r-- | files/js/fileactions.js | 4 | ||||
-rw-r--r-- | files/js/filelist.js | 6 | ||||
-rw-r--r-- | files/js/files.js | 40 | ||||
-rw-r--r-- | files/templates/admin.php | 10 | ||||
-rw-r--r-- | files/templates/index.php | 14 | ||||
-rw-r--r-- | files/templates/part.breadcrumb.php | 2 |
10 files changed, 75 insertions, 40 deletions
diff --git a/files/ajax/scan.php b/files/ajax/scan.php index db09b7d5c64..c60e34b5176 100644 --- a/files/ajax/scan.php +++ b/files/ajax/scan.php @@ -5,6 +5,7 @@ require_once '../../lib/base.php'; set_time_limit(0);//scanning can take ages $force=isset($_GET['force']) and $_GET['force']=='true'; +$dir=isset($_GET['dir'])?$_GET['dir']:''; $checkOnly=isset($_GET['checkonly']) and $_GET['checkonly']=='true'; if(!$checkOnly){ @@ -16,7 +17,7 @@ if(!$checkOnly){ if($force or !OC_FileCache::inCache('')){ if(!$checkOnly){ OC_DB::beginTransaction(); - OC_FileCache::scan('',$eventSource); + OC_FileCache::scan($dir,$eventSource); OC_FileCache::clean(); OC_DB::commit(); $eventSource->send('success',true); diff --git a/files/ajax/upload.php b/files/ajax/upload.php index af7a7acf702..b04796e3248 100644 --- a/files/ajax/upload.php +++ b/files/ajax/upload.php @@ -47,10 +47,10 @@ $result=array(); if(strpos($dir,'..') === false){ $fileCount=count($files['name']); for($i=0;$i<$fileCount;$i++){ - $target=stripslashes($dir) . $files['name'][$i]; + $target = OC_Helper::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]); if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i],$target)){ $meta=OC_FileCache::getCached($target); - $result[]=array( "status" => "success", 'mime'=>$meta['mimetype'],'size'=>$meta['size'],'name'=>$files['name'][$i]); + $result[]=array( "status" => "success", 'mime'=>$meta['mimetype'],'size'=>$meta['size'],'name'=>basename($target)); } } OC_JSON::encodedPrint($result); diff --git a/files/appinfo/app.php b/files/appinfo/app.php index 1b495e52f40..c4a2ee7407a 100644 --- a/files/appinfo/app.php +++ b/files/appinfo/app.php @@ -5,6 +5,6 @@ $l=OC_L10N::get('files'); OC_App::register( array( "order" => 2, "id" => "files", "name" => "Files" )); -OC_App::addNavigationEntry( array( "id" => "files_index", "order" => 1, "href" => OC_Helper::linkTo( "files", "index.php" ), "icon" => OC_Helper::imagePath( "core", "places/home.svg" ), "name" => $l->t("Files") )); +OC_App::addNavigationEntry( array( "id" => "files_index", "order" => 0, "href" => OC_Helper::linkTo( "files", "index.php" ), "icon" => OC_Helper::imagePath( "core", "places/home.svg" ), "name" => $l->t("Files") )); OC_Search::registerProvider('OC_Search_Provider_File'); diff --git a/files/css/files.css b/files/css/files.css index 5dc7983bec4..b544d08cb1a 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, Jan-Christoph Borchardt +/* Copyright (c) 2011, Jan-Christoph Borchardt, http://jancborchardt.net This file is licensed under the Affero General Public License version 3 or later. See the COPYING-README file. */ @@ -25,10 +25,10 @@ #file_newfolder_submit, #file_upload_submit { width:3em; } .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;} +.file_upload_start { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter:alpha(opacity=0); opacity:0; z-index:1; position:absolute; left:0; top:0; width:100%; cursor:pointer;} .file_upload_filename.active { border-bottom-right-radius:0 } .file_upload_filename { position: relative; z-index:100; padding-left: 0.8em; padding-right: 0.8em; cursor:pointer; border-top-left-radius:0; border-bottom-left-radius:0; } -.file_upload_filename img { position: absolute; top: 0.4em; left: 0.4em; } +.file_upload_filename img { position: absolute; top: 0.4em; left: 0.4em; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; } #upload { position:absolute; right:13.5em; top:0em; } #upload #uploadprogressbar { position:relative; display:inline-block; width:10em; height:1.5em; top:.4em; } @@ -37,14 +37,15 @@ /* FILE TABLE */ #emptyfolder { position:absolute; margin:10em 0 0 10em; font-size:1.5em; font-weight:bold; color:#888; text-shadow:#fff 0 1px 0; } +.emptyfolder #new, .emptyfolder .file_upload_filename { background:#66f866; border:1px solid #5e5; -moz-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; -webkit-box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; box-shadow:0 1px 1px #f8f8f8, 0 1px 1px #cfc inset; } table { position:relative; top:37px; width:100%; } tbody tr { background-color:#fff; height:2.5em; } tbody tr:hover, tbody tr:active, tbody tr.selected { background-color:#f8f8f8; } tbody tr.selected { background-color:#eee; } tbody a { color:#000; } span.extension, span.uploading, td.date { color:#999; } -span.extension { text-transform:lowercase; opacity:0; -webkit-transition:opacity 500ms; -moz-transition:opacity 500ms; -o-transition:opacity 500ms; transition:opacity 500ms; } -tr:hover span.extension { opacity:1; } +span.extension { text-transform:lowercase; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; filter:alpha(opacity=70); opacity:.7; -webkit-transition:opacity 300ms; -moz-transition:opacity 300ms; -o-transition:opacity 300ms; transition:opacity 300ms; } +tr:hover span.extension { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; color:#777; } div.crumb { float:left; display:block; background:no-repeat right 0; padding:.75em 1.5em 0 1em; height:2.9em; } div.crumb:first-child { padding-left:1em; } div.crumb.last { font-weight:bold; } @@ -58,7 +59,7 @@ table th#headerSize, table td.filesize { width:3em; padding:0 1em; text-align:ri table th#headerDate, table td.date { width:11em; 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; height:1.5em; vertical-align:middle; margin-left:3em; } -table tr[data-type="dir"] td.filename a.name {font-weight:bold; } +table tr[data-type="dir"] td.filename a.name span.nametext {font-weight:bold; } table td.filename a.name input, table td.filename a.name form { width:100%; cursor:text; } table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:.2em .5em .5em 0; } table td.filename .nametext, .uploadtext, .modified { float:left; padding:.3em 0; } @@ -68,15 +69,20 @@ table td.filename .uploadtext { font-weight:normal; margin-left:.5em; } table td.filename form { float:left; font-size:.85em; } table thead.fixed tr{ position:fixed; top:6.5em; z-index:49; -moz-box-shadow:0 -3px 7px #ddd; -webkit-box-shadow:0 -3px 7px #ddd; box-shadow:0 -3px 7px #ddd; } table thead.fixed { height:2em; } -#fileList tr td.filename>input[type=checkbox]:first-child { opacity:0; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; float:left; margin:.7em 0 0 1em; /* bigger clickable area doesn’t work in FF width:2.8em; height:2.4em;*/ -webkit-transition:opacity 500ms; -moz-transition:opacity 500ms; -o-transition:opacity 500ms; transition:opacity 500ms; } -#fileList tr td.filename>input[type="checkbox"]:hover:first-child { opacity:.8; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; } -#fileList tr td.filename>input[type="checkbox"]:checked:first-child { opacity:1; } +#fileList tr td.filename>input[type=checkbox]:first-child { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter:alpha(opacity=0); opacity:0; float:left; margin:.7em 0 0 1em; /* bigger clickable area doesn’t work in FF width:2.8em; height:2.4em;*/ -webkit-transition:opacity 200ms; -moz-transition:opacity 200ms; -o-transition:opacity 200ms; transition:opacity 200ms; } +#fileList tr td.filename>input[type="checkbox"]:hover:first-child { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; filter:alpha(opacity=80); opacity:.8; } +#fileList tr td.filename>input[type="checkbox"]:checked:first-child { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; } #fileList tr td.filename { -webkit-transition:background-image 500ms; -moz-transition:background-image 500ms; -o-transition:background-image 500ms; transition:background-image 500ms; } #select_all { float:left; margin:.3em 0.6em 0 .5em; } #uploadsize-message,#delete-confirm { display:none; } -.selectedActions a,#fileList a.action { display:inline; margin:0 .5em; padding:.3em .3em 0 .3em !important; } -a.action>img{ max-height:16px; max-width:16px; vertical-align:text-top; } -.selectedActions { display:none; } +.fileactions { position:relative; top:.3em; right:-4em; font-size:.8em; } +#fileList .fileactions a.action img { position:relative; top:.2em; } +#fileList a.action { display:inline; margin:-.5em 0; padding:1em .5em 1em .5em !important; } +a.action.delete { float:right; } +a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; } +.selectedActions { display:none; float:right; } +.selectedActions a { display:inline; margin:-.5em 0; padding:.5em !important; } +.selectedActions a img { position:relative; top:.3em; } /* add breadcrumb divider to the File item in navigation panel */ #navigation>ul>li:first-child { background:url('../../core/img/breadcrumb-start.svg') no-repeat 12.5em 0px; width:12.5em; padding-right:1em; position:fixed; } diff --git a/files/js/fileactions.js b/files/js/fileactions.js index 07838261b87..975af938440 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -53,7 +53,7 @@ FileActions={ }, display:function(parent){ FileActions.currentFile=parent; - $('#fileList .action').remove(); + $('#fileList span.fileactions, #fileList td.date a.action').remove(); var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); var file=FileActions.getCurrentFile(); if($('tr').filterAttr('data-file',file).data('renaming')){ @@ -113,7 +113,7 @@ FileActions={ return false; }, hide:function(){ - $('#fileList span.fileactions').fadeOut(200,function(){ + $('#fileList span.fileactions, #fileList td.date a.action').fadeOut(200,function(){ $(this).remove(); }); }, diff --git a/files/js/filelist.js b/files/js/filelist.js index c8ceb474413..febdfc473b1 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -1,4 +1,5 @@ FileList={ + useUndo:true, update:function(fileListHtml) { $('#fileList').empty().html(fileListHtml); }, @@ -164,7 +165,7 @@ FileList={ }); }, do_delete:function(files){ - if(FileList.deleteFiles){//finish any ongoing deletes first + if(FileList.deleteFiles || !FileList.useUndo){//finish any ongoing deletes first FileList.finishDelete(function(){ FileList.do_delete(files); }); @@ -197,7 +198,6 @@ FileList={ boolOperationFinished(data, function(){ $('#notification').fadeOut(); $.each(FileList.deleteFiles,function(index,file){ -// alert(file); FileList.remove(file); }); FileList.deleteCanceled=true; @@ -226,7 +226,7 @@ $(document).ready(function(){ } $('#notification').fadeOut(); }); - + FileList.useUndo=('onbeforeunload' in window) $(window).bind('beforeunload', function (){ FileList.finishDelete(null,true); }); diff --git a/files/js/files.js b/files/js/files.js index 56fff753737..e13e256efc4 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -42,9 +42,11 @@ $(document).ready(function() { //drag/drop of files $('#fileList tr td.filename').draggable(dragOptions); $('#fileList tr[data-type="dir"][data-write="true"] td.filename').droppable(folderDropOptions); - $('div.crumb').droppable(crumbDropOptions); + $('div.crumb:not(.last)').droppable(crumbDropOptions); $('ul#apps>li:first-child').data('dir',''); - $('ul#apps>li:first-child').droppable(crumbDropOptions); + if($('div.crumb').length){ + $('ul#apps>li:first-child').droppable(crumbDropOptions); + } // Triggers invisible file input $('.file_upload_button_wrapper').live('click', function() { @@ -329,7 +331,7 @@ $(document).ready(function() { var size=t('files','Pending'); } if(files && !dirName){ - FileList.addFile(files[i].name,size,date,true); + FileList.addFile(getUniqueName(files[i].name),size,date,true); } else if(dirName) { var uploadtext = $('tr').filterAttr('data-type', 'dir').filterAttr('data-file', dirName).find('.uploadtext') var currentUploads = parseInt(uploadtext.attr('currentUploads')); @@ -348,7 +350,7 @@ $(document).ready(function() { } }else{ var filename=this.value.split('\\').pop(); //ie prepends C:\fakepath\ in front of the filename - FileList.addFile(filename,'Pending',date,true); + FileList.addFile(getUniqueName(filename),'Pending',date,true); } } }, @@ -519,12 +521,15 @@ $(document).ready(function() { }, "json"); }); -function scanFiles(force){ +function scanFiles(force,dir){ + if(!dir){ + dir=''; + } force=!!force; //cast to bool scanFiles.scanning=true; $('#scanning-message').show(); $('#fileList').remove(); - var scannerEventSource=new OC.EventSource(OC.filePath('files','ajax','scan.php'),{force:force}); + var scannerEventSource=new OC.EventSource(OC.filePath('files','ajax','scan.php'),{force:force,dir:dir}); scanFiles.cancel=scannerEventSource.close.bind(scannerEventSource); scannerEventSource.listen('scanning',function(data){ $('#scan-count').text(data.count+' files scanned'); @@ -563,7 +568,7 @@ var dragOptions={ }; var folderDropOptions={ drop: function( event, ui ) { - var file=ui.draggable.text().trim(); + var file=ui.draggable.parent().data('file'); var target=$(this).text().trim(); var dir=$('#dir').val(); $.ajax({ @@ -589,7 +594,7 @@ var crumbDropOptions={ if(dir.substr(-1,1)!='/'){ dir=dir+'/'; } - if(target==dir){ + if(target==dir || target+'/'==dir){ return; } $.ajax({ @@ -719,3 +724,22 @@ function getMimeIcon(mime, ready){ } } getMimeIcon.cache={}; + +function getUniqueName(name){ + if($('tr').filterAttr('data-file',name).length>0){ + var parts=name.split('.'); + var extension=parts.pop(); + var base=parts.join('.'); + numMatch=base.match(/\((\d+)\)/); + var num=2; + if(numMatch && numMatch.length>0){ + num=parseInt(numMatch[numMatch.length-1])+1; + base=base.split('(') + base.pop(); + base=base.join('(').trim(); + } + name=base+' ('+num+').'+extension; + return getUniqueName(name); + } + return name; +} diff --git a/files/templates/admin.php b/files/templates/admin.php index 9bcc40e9361..01fe1105260 100644 --- a/files/templates/admin.php +++ b/files/templates/admin.php @@ -7,9 +7,13 @@ <label for="maxUploadSize"><?php echo $l->t( 'Maximum upload size' ); ?> </label><input name='maxUploadSize' id="maxUploadSize" value='<?php echo $_['uploadMaxFilesize'] ?>'/>(<?php echo $l->t('max. possible: '); echo $_['maxPossibleUploadSize'] ?>)<br/> <?php endif;?> <input type="checkbox" name="allowZipDownload" id="allowZipDownload" value="1" title="<?php echo $l->t( 'Needed for multi-file and folder downloads.' ); ?>"<?php if ($_['allowZipDownload']) echo ' checked="checked"'; ?> /> <label for="allowZipDownload"><?php echo $l->t( 'Enable ZIP-download' ); ?></label> <br/> - <fieldset class="personalblock"> - <label for="maxZipInputSize"><?php echo $l->t( 'Maximum input size for ZIP files:' ); ?> </label><input name="maxZipInputSize" id="maxZipInputSize" value='<?php echo $_['maxZipInputSize'] ?>' title="<?php echo $l->t( '0 is unlimited' ); ?>"<?php if (!$_['allowZipDownload']) echo ' disabled="disabled"'; ?> /><br/> - </fieldset> + + <input name="maxZipInputSize" id="maxZipInputSize" style="width:180px;" value='<?php echo $_['maxZipInputSize'] ?>' title="<?php echo $l->t( '0 is unlimited' ); ?>"<?php if (!$_['allowZipDownload']) echo ' disabled="disabled"'; ?> /> + <label for="maxZipInputSize"><?php echo $l->t( 'Maximum input size for ZIP files' ); ?> </label><br /> + <input type="submit" name="submitFilesAdminSettings" id="submitFilesAdminSettings" value="Save"/> </fieldset> </form> + + + diff --git a/files/templates/index.php b/files/templates/index.php index 2a09c309045..3c76eb0187d 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -2,7 +2,7 @@ <div id="controls"> <?php echo($_['breadcrumb']); ?> <?php if (!isset($_['readonly']) || !$_['readonly']):?> - <div class="actions"> + <div class="actions <?php if (isset($_['files']) and ! $_['readonly'] and count($_['files'])==0):?>emptyfolder<?php endif; ?>"> <div id='new' class='button'> <a><?php echo $l->t('New');?></a> <ul class="popup popupTop"> @@ -15,7 +15,7 @@ <form data-upload-id='1' class="file_upload_form" action="ajax/upload.php" method="post" enctype="multipart/form-data" target="file_upload_target_1"> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload"> <input type="hidden" class="max_human_file_size" value="(max <?php echo $_['uploadMaxHumanFilesize']; ?>)"> - <input type="hidden" name="dir" value="<?php echo $_['dir'] ?>" id="dir"> + <input type="hidden" name="dir" value="<?php echo htmlentities($_['dir']) ?>" id="dir"> <button class="file_upload_filename"> <img class='svg action' alt="Upload" src="<?php echo image_path("core", "actions/upload.svg"); ?>" /></button> <input class="file_upload_start" type="file" name='files[]'/> <a href="#" class="file_upload_button_wrapper" onclick="return false;" title="<?php echo $l->t('Upload'); echo ' max. '.$_['uploadMaxHumanFilesize'] ?>"></a> @@ -46,14 +46,14 @@ <?php if(!isset($_['readonly']) || !$_['readonly']) { ?><input type="checkbox" id="select_all" /><?php } ?> <span class='name'><?php echo $l->t( 'Name' ); ?></span> <span class='selectedActions'> - <?php if($_['allowZipDownload']) : ?> - <a href="" title="<?php echo $l->t('Download')?>" class="download"><img class='svg' alt="Download" src="<?php echo image_path("core", "actions/download.svg"); ?>" /></a> - <?php endif; ?> - <a href="" title="Share" class="share"><img class='svg' alt="Share" src="<?php echo image_path("core", "actions/share.svg"); ?>" /></a> + <a href="" class="share"><img class='svg' alt="Share" src="<?php echo image_path("core", "actions/share.svg"); ?>" /> <?php echo $l->t('Share')?></a> + <?php if($_['allowZipDownload']) : ?> + <a href="" class="download"><img class='svg' alt="Download" src="<?php echo image_path("core", "actions/download.svg"); ?>" /> <?php echo $l->t('Download')?></a> + <?php endif; ?> </span> </th> <th id="headerSize"><?php echo $l->t( 'Size' ); ?></th> - <th id="headerDate"><span id="modified"><?php echo $l->t( 'Modified' ); ?></span><span class="selectedActions"><a href="" title="Delete" class="delete"><img class="svg" alt="<?php echo $l->t('Delete')?>" src="<?php echo image_path("core", "actions/delete.svg"); ?>" /></a></span></th> + <th id="headerDate"><span id="modified"><?php echo $l->t( 'Modified' ); ?></span><span class="selectedActions"><a href="" class="delete"><?php echo $l->t('Delete all')?> <img class="svg" alt="<?php echo $l->t('Delete')?>" src="<?php echo image_path("core", "actions/delete.svg"); ?>" /></a></span></th> </tr> </thead> <tbody id="fileList" data-readonly="<?php echo $_['readonly'];?>"> diff --git a/files/templates/part.breadcrumb.php b/files/templates/part.breadcrumb.php index ab81cc5c039..16da6bb97b4 100644 --- a/files/templates/part.breadcrumb.php +++ b/files/templates/part.breadcrumb.php @@ -1,6 +1,6 @@ <?php for($i=0; $i<count($_["breadcrumb"]); $i++): $crumb = $_["breadcrumb"][$i]; ?> <div class="crumb <?php if($i == count($_["breadcrumb"])-1) echo 'last';?> svg" data-dir='<?php echo $crumb["dir"];?>' style='background-image:url("<?php echo image_path('core','breadcrumb.png');?>")'> - <a href="<?php echo $_['baseURL'].$crumb["dir"]; ?>"><?php echo htmlspecialchars($crumb["name"]); ?></a> + <a href="<?php echo $_['baseURL'].$crumb["dir"]; ?>"><?php echo htmlentities($crumb["name"]); ?></a> </div> <?php endfor;?>
\ No newline at end of file |