diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2011-04-16 22:56:40 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2011-04-16 22:56:40 +0200 |
commit | a7da3cd6a0f847820efd71a7aa2f58fb4fcf05a0 (patch) | |
tree | e55948bb0d1e580ae2632c7ba50b02c710ea5b76 | |
parent | 6d64a90c240bb88f750f8744449bd8e6e400dfe8 (diff) | |
download | nextcloud-server-a7da3cd6a0f847820efd71a7aa2f58fb4fcf05a0.tar.gz nextcloud-server-a7da3cd6a0f847820efd71a7aa2f58fb4fcf05a0.zip |
basic file upload reimplemented
-rw-r--r-- | files/css/files.css | 8 | ||||
-rw-r--r-- | files/index.php | 1 | ||||
-rw-r--r-- | files/js/files.js | 21 | ||||
-rw-r--r-- | files/templates/index.php | 14 |
4 files changed, 43 insertions, 1 deletions
diff --git a/files/css/files.css b/files/css/files.css index 8ab07d45241..160c9307409 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -19,6 +19,14 @@ text-decoration: none; } +#file_upload_form { + display: none; +} + +#file_upload_target { + display: none; +} + /* FILE TABLE */ table td.filesize, table td.date diff --git a/files/index.php b/files/index.php index a68ae9c0bb4..7f6a11ff03c 100644 --- a/files/index.php +++ b/files/index.php @@ -59,6 +59,7 @@ foreach( explode( "/", $dir ) as $i ){ $tmpl = new OC_TEMPLATE( "files", "index", "user" ); $tmpl->assign( "files", $files ); $tmpl->assign( "breadcrumb", $breadcrumb ); +$tmpl->assign( 'dir', $dir); $tmpl->printPage(); ?> diff --git a/files/js/files.js b/files/js/files.js index 9ab573ee92b..ba08e254349 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -36,4 +36,25 @@ $(document).ready(function() { // Uncheck all $('.browser input:checkbox').attr('checked', false); }); + + // Shows and hides file upload form + $('#file_upload_button').toggle(function() { + $('#file_upload_form').css({"display":"block"}); + }, function() { + $('#file_upload_form').css({"display":"none"}); + }); + + $('#file_upload_start').click(function() { + $('#file_upload_target').load(uploadFinished); + }); }); + +function uploadFinished() { + result = $('#file_upload_target').contents().text(); + result = eval("(" + result + ");"); + if(result.status == "error") { + alert('An error occcured, upload failed.'); + } else { + location.href = 'index.php?dir=' + $('#dir').val(); + } +} diff --git a/files/templates/index.php b/files/templates/index.php index f1fdafc27cc..94d3769c9ac 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -7,8 +7,20 @@ <div class="controls"> <p class="actions"> - <a href="" title="" class="upload">Upload</a><a href="" title="" class="new-dir">New folder</a><a href="" title="" class="download">Download</a><a href="" title="" class="share">Share</a><a href="" title="" class="delete">Delete</a> + <a href="" title="" class="upload" id="file_upload_button">Upload</a><a +href="" title="" class="new-dir">New folder</a><a href="" title="" +class="download">Download</a><a href="" title="" class="share">Share</a><a +href="" title="" class="delete">Delete</a> </p> + <div id="file_upload_form"> + <form action="ajax/upload.php" +method="post" enctype="multipart/form-data" target="file_upload_target"><input +type="hidden" name="MAX_FILE_SIZE" value="2097152" id="max_upload"><input +type="hidden" name="dir" value="<?php echo $_["dir"] ?>" id="dir"><input +type="file" name="file" id="fileSelector"><input type="submit" +id="file_upload_start" value="Upload" /><iframe id="file_upload_target" +name="file_upload_target" src=""></iframe></form> + </div> </div> <p class="nav"> |