diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-11-10 16:40:09 +0100 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-11-10 16:40:09 +0100 |
commit | 524e3686a0da79493a6048d8d92b7bbb0982ec08 (patch) | |
tree | df3ff86248e797cc86ab2e2df0cc9061b4c5221e /files | |
parent | 5a6aba1e1114707942c613c2402eed3237b43a21 (diff) | |
download | nextcloud-server-524e3686a0da79493a6048d8d92b7bbb0982ec08.tar.gz nextcloud-server-524e3686a0da79493a6048d8d92b7bbb0982ec08.zip |
tell the user when the files are being scanned
Diffstat (limited to 'files')
-rw-r--r-- | files/ajax/scan.php | 16 | ||||
-rw-r--r-- | files/css/files.css | 4 | ||||
-rw-r--r-- | files/js/files.js | 19 | ||||
-rw-r--r-- | files/templates/index.php | 5 |
4 files changed, 43 insertions, 1 deletions
diff --git a/files/ajax/scan.php b/files/ajax/scan.php new file mode 100644 index 00000000000..dec949a819b --- /dev/null +++ b/files/ajax/scan.php @@ -0,0 +1,16 @@ +<?php + +require_once '../../lib/base.php'; + +$force=isset($_GET['force']) and $_GET['force']=='true'; +$checkOnly=isset($_GET['checkonly']) and $_GET['checkonly']=='true'; + +//create the file cache if necesary +if($force or !OC_FileCache::inCache('')){ + if(!$checkOnly){ + OC_FileCache::scan(''); + } + OC_JSON::success(array("data" => array( "done" => true))); +}else{ + OC_JSON::success(array("data" => array( "done" => false))); +}
\ No newline at end of file diff --git a/files/css/files.css b/files/css/files.css index 22f4810d0a6..39f0b9fe780 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -73,4 +73,6 @@ table thead.fixed { height:2em; } /* 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; } -#navigation>ul>li:first-child+li { padding-top:2.9em; }
\ No newline at end of file +#navigation>ul>li:first-child+li { padding-top:2.9em; } + +#scanning-message{ top:40%; left:40%; position:absolute; display:none }
\ No newline at end of file diff --git a/files/js/files.js b/files/js/files.js index 4eaa098241b..4dca1a110ec 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -334,8 +334,27 @@ $(document).ready(function() { $('#new>a').click(); }); }); + + //check if we need to scan the filesystem + $.get(OC.filePath('files','ajax','scan.php'),{checkonly:'true'}, function(response) { + if(response.data.done){ + scanFiles(); + } + }, "json"); }); +function scanFiles(force){ + force=!!force; //cast to bool + $('#scanning-message').show(); + $.get(OC.filePath('files','ajax','scan.php'), function(response) { + if(response && response.data && response.data.done){ + window.location.reload(); + }else{ + alert('error') + } + }, "json"); +} + function boolOperationFinished(data, callback) { result = jQuery.parseJSON(data.responseText); if(result.status == 'success'){ diff --git a/files/templates/index.php b/files/templates/index.php index 722c38e4776..21a4e2df010 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -63,3 +63,8 @@ if (isset($_['files'])) { <?php echo $l->t('The files you are trying to upload exceed the maximum size for file uploads on this server.');?> </p> </div> +<div id="scanning-message"> + <p> + <?php echo $l->t('Files are being scanned, please wait.');?> + </p> +</div> |