diff options
| author | oweissbarth | 2014-03-27 01:48:34 +0100 |
|---|---|---|
| committer | oweissbarth | 2014-03-27 01:48:34 +0100 |
| commit | 9469e30334580ada1a8c5761301fc2b1481e4355 (patch) | |
| tree | 14a98ad151809b7cb41f34de9da98e61bce9e01e /www/browse.php | |
| parent | 84f44351d1f9e11d6b1421aa2de77c3414058159 (diff) | |
| download | files.iamfabulous.de-9469e30334580ada1a8c5761301fc2b1481e4355.tar.gz | |
Added upload ui
Diffstat (limited to 'www/browse.php')
| -rw-r--r-- | www/browse.php | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/www/browse.php b/www/browse.php index d01df6e..a4b9e84 100644 --- a/www/browse.php +++ b/www/browse.php @@ -7,8 +7,11 @@ function print_browser($content){ if($_SERVER['REQUEST_METHOD'] == 'POST'){ //echo "created_folder : ". $_POST["foldername"] . " in ". $_GET["folder"]; - - create_folder($_POST["path"], $_POST["foldername"], /*$_POST["public"]?*/"PUBLIC"/*:"PRIVATE"*/); + if($_POST["task"]=="new-folder"){ + create_folder($_POST["path"], $_POST["foldername"], /*$_POST["public"]?*/"PUBLIC"/*:"PRIVATE"*/); + }elseif($_POST["task"]=="upload"){ + upload($_POST["path"]); + } browse(collect_content($GLOBALS["db"], $_SESSION["username"] , $_POST["path"])); }else{ browse(collect_content($GLOBALS["db"], $_GET["name"] , $_GET["folder"])); @@ -24,7 +27,7 @@ function browse($content){ $file_list = ""; - if($content){ + if($content != EMPTY_FOLDER){ foreach($content as $file){ $file_list .= get_item($file); } @@ -34,23 +37,45 @@ function browse($content){ <script> function showNewFolder(){ document.getElementById("new-folder-bg").style.visibility = "visible"; + return; } function hideNewFolder(){ - if(document.getElementById("new-folder-name").value!=""){ - document.getElementById("new-folder-bg").style.visibility = "hidden"; - } + document.getElementById("new-folder-bg").style.visibility = "hidden"; + return; + } + + function showUpload(){ + document.getElementById("upload-bg").style.visibility = "visible"; + return; + } + function hideUpload(){ + document.getElementById("upload-bg").style.visibility = "hidden"; return; } </script> <div id="new-folder-bg"> <div id="new-folder-area"> - <h1 class="new-folder-"> New Folder </h1> + <h1 class="new-folder"> New Folder </h1> <form id="new-folder-form" method="post" action="/'.$_GET["name"]."/".$_GET["folder"].'"> <input class="new-folder-input" id="new-folder-name" type="text" placeholder="name" name="foldername" required> <input type="hidden" value="'.$_GET["folder"].'" name="path"> - <label style="display:inline">Public</label><input style="display:inline; margin-left: 5px;" class="new-folder-input" type="checkbox" name="public"> - <input style="display:block" onclick="hideNewFolder()" type="submit" id="button-input" class="new-folder-input" value="create"> + <input type="hidden" value="new-folder" name="task"> + <label>Public</label><input style="display:inline; margin-left: 5px;" class="new-folder-input" type="checkbox" name="public"> + <input onclick="hide-new-folder()" type="submit" id="button-input" class="new-folder-input" value="create"> + </form> + </div> + </div> + + <div id="upload-bg"> + <div id="upload-area"> + <h1 class="upload"> Upload </h1> + <form id="upload-form" method="post" action="/'.$_GET["name"]."/".$_GET["folder"].'" enctype="multipart/form-data"> + <input class="upload-input" id="upload-file" type="file" placeholder="file" name="userfile" size=" 500000000" maxlength="100000000000000" required> + <input type="hidden" value="'.$_GET["folder"].'" name="path"> + <input type="hidden" value="upload" name="task"> + <label>Public</label><input class="upload-input" type="checkbox" name="share"> + <input onclick="hide-upload()" type="submit" id="button-input" class="upload-input" value="upload"> </form> </div> </div> @@ -79,7 +104,7 @@ function get_item($file){ function print_menu(){ echo '<div id="menu"> - <div class="menu-item" id="new-item" onclick="showNewFolder()" ><img src="/static/img/icon_new.svg" width="45px" onclick="toggleNewFolder()"></div> - <div class="menu-item" id="upload-item"><img src="/static/img/icon_upload.svg" width="45px"></div> + <div class="menu-item" id="new-item" onclick="showNewFolder()" ><img src="/static/img/icon_new.svg" width="45px" onclick="showNewFolder()"></div> + <div class="menu-item" id="upload-item" onclick="showUpload()" ><img src="/static/img/icon_upload.svg" width="45px" onclick="showUpload()" ></div> </div><!-- div menu-->'; } |
